0
我使用下面的gradle生成.jar文件Android Studio - 如何導出其中有其他罐子的罐子?
當我使用下面的gradle導出時,我能夠生成.jar文件,但它沒有附加依賴MyJar文件。
apply plugin: 'com.android.library'//To generate Jar
android {
compileSdkVersion 24
buildToolsVersion "25.0.0"
sourceSets {
main {
//Path to My source code
java {
srcDir 'src/main/java'
}
}
}
defaultConfig {
minSdkVersion 15
targetSdkVersion 24
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:24.2.1'
testCompile 'junit:junit:4.12'
compile files('libs/MyJar.jar')//MyJar When generating the Jar this is not include by gradle?
}
//task to delete the old jar
task deleteOldJar(type: Delete) {
delete 'release/ExportedJar.jar'
}
//task to export contents as jar
task exportJar(type: Copy) {
from('build/intermediates/bundles/release/')
into('release/')
include('classes.jar')
//include('MyJar.jar')//Tried this but No luck
rename('classes.jar', 'ExportedJar.jar')
}
exportJar.dependsOn(deleteOldJar, build)
如何實現這一目標?有沒有turnaround.Thanks提前
嗨Zagorski感謝您的快速reply..got這個錯誤無法獲取不明財產「JAR」的任務在你的情況下,將 –
「:fatJar:應用程序」是'exportJar'。 –