java.lang.ClassNotFoundException:未在路径上找到 class:DexPathList gradle:2.1.0-alpha1
java.lang.ClassNotFoundException: Didn't find class on path: DexPathList gradle:2.1.0-alpha1
所以,我有一个带有私人图书馆的项目。我的库有一些我想在我的项目中使用的 classes,但是当我执行应用程序并尝试访问 class 时,出现了异常:
Process: chat.omni.loja, PID: 32615
java.lang.NoClassDefFoundError: Failed resolution of:
Lcom/omnichat/chat_library/_util/GaleryUtils;
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.omnichat.chat_library._util.GaleryUtils" on path: DexPathList[[dex file "/data/data/chat.omni.loja/files/instant-run/dex/slice-slice_9_c46d74b6abb1c51e69093e6cb8bf4a5f5e9b987f-classes.dex", dex file
...
"/data/data/chat.omni.loja/files/instant-run/dex/slice-dependencies_f7fd1358be3ac9af2f69ac6f15447a76a8be062c-classes.dex"],nativeLibraryDirectories=[/vendor/lib, /system/lib, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
这是我的库构建 gradle:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
ext { supportLibVersion = '23.+' }
//CircleImageView Library
compile 'de.hdodenhof:circleimageview:2.0.0'
compile "com.android.support:appcompat-v7:${supportLibVersion}"
// SMACK Library
compile 'org.igniterealtime.smack:smack-android-extensions:4.2.0-alpha3'
compile 'org.igniterealtime.smack:smack-tcp:4.2.0-alpha3'
//Glide Library
compile 'com.github.bumptech.glide:glide:3.6.1'
//SectionCursorAdapter Library
compile 'com.twotoasters.SectionCursorAdapter:library:1.0.+'
//Android Annotations Library
compile "org.androidannotations:androidannotations-api:$AAVersion"
//Android Annotations apt
apt "org.androidannotations:androidannotations:$AAVersion"
}
我的应用构建 gradle:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
ext { supportLibVersion = '23.+' }
//Library dependency
compile(project(':chat-library')) {
exclude group: 'com.android.support', module: 'appcompat-v7';
exclude group: 'org.androidannotations', module: "androidannotations:$AAVersion";
exclude group: 'org.androidannotations', module: "androidannotations-api:$AAVersion";
}
//Supports Library
compile "com.android.support:design:${supportLibVersion}"
compile "com.android.support:cardview-v7:${supportLibVersion}"
compile "com.android.support:recyclerview-v7:${supportLibVersion}"
compile "com.android.support:support-v4:${supportLibVersion}"
// Crashlytics Kit
compile('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') {
transitive = true
}
//Android Annotations Library
apt "org.androidannotations:androidannotations:$AAVersion"
compile "org.androidannotations:androidannotations-api:$AAVersion"
//Parser Library
compile 'com.parse:parseui-widget-android:0.0.1'
compile 'com.parse.bolts:bolts-android:1.+'
compile 'com.parse:parse-android:1.+'
//Stetho Library
compile 'com.facebook.stetho:stetho:1.2.0'
//Material SearchView Library
compile 'com.miguelcatalan:materialsearchview:1.+'
//CropImage Library
compile 'com.soundcloud.android:android-crop:1.0.0@aar'
}
我的配置是:
- Android Studio 2.1 预览版 1
- Android Gradle 插件 'com.android.tools.build:gradle:2.1.0-alpha1'
- 构建工具版本 23.0.2
- Gradle 版本 2.10
我用谷歌搜索了这个问题 2 天,并尝试了在 SO 上找到的所有内容。所以也许它可能是新 gradle 版本上的错误,但我不能肯定。还有其他人遇到过这个问题吗?
谢谢维克多·戈麦斯!你的建议很棒。我刚刚更新到 gradle-2.11 并且它再次起作用了!
所以,我有一个带有私人图书馆的项目。我的库有一些我想在我的项目中使用的 classes,但是当我执行应用程序并尝试访问 class 时,出现了异常:
Process: chat.omni.loja, PID: 32615
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/omnichat/chat_library/_util/GaleryUtils; Caused by: java.lang.ClassNotFoundException: Didn't find class "com.omnichat.chat_library._util.GaleryUtils" on path: DexPathList[[dex file "/data/data/chat.omni.loja/files/instant-run/dex/slice-slice_9_c46d74b6abb1c51e69093e6cb8bf4a5f5e9b987f-classes.dex", dex file...
"/data/data/chat.omni.loja/files/instant-run/dex/slice-dependencies_f7fd1358be3ac9af2f69ac6f15447a76a8be062c-classes.dex"],nativeLibraryDirectories=[/vendor/lib, /system/lib, /vendor/lib, /system/lib]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
这是我的库构建 gradle:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
ext { supportLibVersion = '23.+' }
//CircleImageView Library
compile 'de.hdodenhof:circleimageview:2.0.0'
compile "com.android.support:appcompat-v7:${supportLibVersion}"
// SMACK Library
compile 'org.igniterealtime.smack:smack-android-extensions:4.2.0-alpha3'
compile 'org.igniterealtime.smack:smack-tcp:4.2.0-alpha3'
//Glide Library
compile 'com.github.bumptech.glide:glide:3.6.1'
//SectionCursorAdapter Library
compile 'com.twotoasters.SectionCursorAdapter:library:1.0.+'
//Android Annotations Library
compile "org.androidannotations:androidannotations-api:$AAVersion"
//Android Annotations apt
apt "org.androidannotations:androidannotations:$AAVersion"
}
我的应用构建 gradle:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
ext { supportLibVersion = '23.+' }
//Library dependency
compile(project(':chat-library')) {
exclude group: 'com.android.support', module: 'appcompat-v7';
exclude group: 'org.androidannotations', module: "androidannotations:$AAVersion";
exclude group: 'org.androidannotations', module: "androidannotations-api:$AAVersion";
}
//Supports Library
compile "com.android.support:design:${supportLibVersion}"
compile "com.android.support:cardview-v7:${supportLibVersion}"
compile "com.android.support:recyclerview-v7:${supportLibVersion}"
compile "com.android.support:support-v4:${supportLibVersion}"
// Crashlytics Kit
compile('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') {
transitive = true
}
//Android Annotations Library
apt "org.androidannotations:androidannotations:$AAVersion"
compile "org.androidannotations:androidannotations-api:$AAVersion"
//Parser Library
compile 'com.parse:parseui-widget-android:0.0.1'
compile 'com.parse.bolts:bolts-android:1.+'
compile 'com.parse:parse-android:1.+'
//Stetho Library
compile 'com.facebook.stetho:stetho:1.2.0'
//Material SearchView Library
compile 'com.miguelcatalan:materialsearchview:1.+'
//CropImage Library
compile 'com.soundcloud.android:android-crop:1.0.0@aar'
}
我的配置是:
- Android Studio 2.1 预览版 1
- Android Gradle 插件 'com.android.tools.build:gradle:2.1.0-alpha1'
- 构建工具版本 23.0.2
- Gradle 版本 2.10
我用谷歌搜索了这个问题 2 天,并尝试了在 SO 上找到的所有内容。所以也许它可能是新 gradle 版本上的错误,但我不能肯定。还有其他人遇到过这个问题吗?
谢谢维克多·戈麦斯!你的建议很棒。我刚刚更新到 gradle-2.11 并且它再次起作用了!