我正在使用另一个aar和jar文件依赖项创建AAR文件。我已经成功创建了.aar发布文件。
接下来,我将我的新AAR文件导入示例项目中。该项目运行良好。当尝试访问aar和jar类时,显示“NoClassDefFound”错误。
注意:首先我想知道现在是否可以在另一个AAR文件中嵌套AAR文件。有人能帮我解决这个新问题吗?
我还参考了此链接。它说transitive = true。但是不明白在第三方应用程序中使用还是在创建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
}
transitive=true
到你所包含的依赖项中。 - Vipul Asribuild.gradle
的代码。 - Vipul Asri