I am trying to use an existing Android project as a library for my app:
https://github.com/LarsWerkman/HoloColorPicker
The java code compiles, but when I run my app the following error occurs:
java.lang.ClassNotFoundException: Didn't find class
"com.larswerkman.colorpicker.ColorPicker" on path:
DexPathList[[zip file "data/app/myApp.apk"], nativeLibraryDirectories=
[/data/app-lib/myApp, /system/lib]]
I know that I am not the first to address this exception, but I am really out of inspiration. I tried the following:
NONE of these fixes the problem. I want to know what the propper way is to include a project as a library.
Also, the documentation of the ColorPicker project, says that I include this somewhere as a dependency:
dependencies {
compile 'com.larswerkman:HoloColorPicker:1.4'
}
In what file should I include this?
You should include this in build.gradle file of your application.
This is how build.gradle would like:
apply plugin: 'com.android.library'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
minSdkVersion 14
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.android.support:recyclerview-v7:+'
compile 'com.android.support:support-v4:+'
compile 'com.larswerkman:HoloColorPicker:1.4'
}
Just see above I have included HoloColorPicker library.
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.