我正在使用另一个aar和jar文件依赖项创建AAR文件.我已成功创建.aar发布文件.
然后,我将新的AAR文件导入到示例项目中.该项目运行良好.当要访问aar和jar类时,它显示NoClassDefFound错误.
注意:首先我想知道,截至目前,另一个AAR中的AAR是否有可能.任何人都可以帮助我摆脱这个新事物的问题吗?
我也提到了这个链接Create an AAR with multiple AARs/JARs.它说transitive = true.但是,不明白,在哪里使用那个标志.在第三方使用Application或在AAR项目依赖项中创建AAR.
谢谢提前.
我的迷你项目Gradle文件:
Mini Project,只转换为.AAR文件.那么,这个文件只会使用另一个NewProject
Mini Project Build.gradle文件
/*
This would be enabled for development purpose and to debug and check the same
*/
apply plugin: 'com.android.application'
/*
This would be enabled for exporting as aar file
apply plugin: 'com.android.library'
*/
//apply plugin: 'com.android.library'
android {
compileSdkVersion 23
buildToolsversion "23.0.2"
dexOptions {
javaMaxHeapSize "4g"
preDexLibraries = false
}
defaultConfig {
/*
This application id would be used for development purpose and to debug and check the same.
This would be commented when exporting as library
*/
applicationId 'com.pss.pssplayer'
minSdkVersion 18
targetSdkVersion 23
multiDexEnabled true
versionCode 1
versionName "1.0"
}
aaptOptions {
cruncherEnabled = false
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
compile filetree(include: ['*.jar'],dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:support-v4:23.1.1'
compile files('libs/ksoap2-android-assembly-3.2.0-jar-with-dependencies.jar')
compile files('libs/secure.jar')
compile(project(':getSubProject')) {
transitive = true
}// this getSubProject also contains one classes jar
}
解决方法
使用
android-fat-aar gradle插件,它超级实用!