I created a library and this library use another external library (just one).
This is the configuration of my library:
apply plugin: 'com.android.library'
android {
compileSdkVersion 26
defaultConfig {
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
compile ('com.github.Paroca72:sc-gauges:3.0.1') {
transitive=true
}
}
Export the library, as .aar, using gradle -> :library -> assembleRelease. Now iclude the library in a new project using "import .JAR/.AAR package" and including it in "module dependency"..
In the coding phase I no have errors but when I try to start the application I have this kind of exception:
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.sccomponents.codes.gauges.ScArcGauge" on path: DexPathList[[zip file "/data/app/com.test.test-oKxgn-etFOgh1n6SqKQU5Q==/base.apk", zip file "/data/app/com.test.test-oKxgn-etFOgh1n6SqKQU5Q==/split_lib_dependencies_apk.apk", zip file "/data/app/com.test.test-oKxgn-etFOgh1n6SqKQU5Q==/split_lib_slice_0_apk.apk", zip file "/data/app/com.test.test-oKxgn-etFOgh1n6SqKQU5Q==/split_lib_slice_1_apk.apk", zip file "/data/app/com.test.test-oKxgn-etFOgh1n6SqKQU5Q==/split_lib_slice_2_apk.apk", zip file "/data/app/com.test.test-oKxgn-etFOgh1n6SqKQU5Q==/split_lib_slice_3_apk.apk", zip file "/data/app/com.test.test-oKxgn-etFOgh1n6SqKQU5Q==/split_lib_slice_4_apk.apk", zip file "/data/app/com.test.test-oKxgn-etFOgh1n6SqKQU5Q==/split_lib_slice_5_apk.apk", zip file "/data/app/com.test.test-oKxgn-etFOgh1n6SqKQU5Q==/split_lib_slice_6_apk.apk", zip file "/data/app/com.test.test-oKxgn-etFOgh1n6SqKQU5Q==/split_lib_slice_7_apk.apk", zip file "/data/app/com.test.test-oKxgn-etFOgh1n6SqKQU5Q==/split_lib_slice_8_apk.apk", zip file "/data/app/com.test.test-oKxgn-etFOgh1n6SqKQU5Q==/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.test.test-oKxgn-etFOgh1n6SqKQU5Q==/lib/x86, /system/lib, /vendor/lib]]
Referred to the external library "com.sccomponents.codes.gauges.ScArcGauge" that was include in my own library..
What wrong?
I'm using Android Studio (latest version)
Most likely when you included your library via Android Studio you ended up with something like
compile 'yourlibrary":1.0.0@aar'
So it means that only the aar will be pulled in and not your dependencies. You need to change it to
compile ('yourlibrary":1.0.0@aar'){ transitive=true }
Please follow the below steps.
May be because its not added the library at run time.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.