我尝试创建一个自定义插件以在nativescript上拍照。但是,当我想导出jar来创建该插件时,找不到它。我在构建文件(捆绑包和打包的类)中搜索了它,但是没有找到任何东西。
按照我的build.gradle:
apply plugin: 'com.android.library'
android {
compileSdkVersion 30
buildToolsVersion "30.0.1"
defaultConfig {
minSdkVersion 19
targetSdkVersion 30
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'androidx.appcompat:appcompat:1.2.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}
// task to delete the old jar
task deleteOldJar(type: Delete) {
delete'release/ToastPlugin.jar'
}
// task to export contents as jar
task exportJar(type: Copy) {
from('build/intermediates/bundles/release/')
into('release')
include('classes.jar')
// name the plugin
rename('classes.jar','ToastPlugin.jar')
}
exportJar.dependsOn(deleteOldJar, build)
exportJar可以正常工作,但是未创建发行包,并且ToastPlugin.jar不存在。
预先感谢您的帮助。
答案 0 :(得分:0)
生成jar之后,您可以在realese文件夹中找到它。
请遵循tutorial以获取详细信息。
答案 1 :(得分:0)
好,我找到了文件。它在/ build / intermediates / aar_main_jar / release /目录中,而不是像我在其他教程中写的那样捆绑在一起。不幸的是,在解决问题后,我发现了这个主题:Jar is not generated after running build task in android gradle 3.6.1。 我希望它能在相同情况下为人们提供帮助。