本文介绍了NoClassDefFoundError Landroid/arch/lifecycle/LifecycleDispatcher的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想从Google试用新的生命周期资料( https://developer.android.com/arch ),但在应用打开时崩溃.我要做的就是添加依赖项.还有其他人有这个问题吗?
I want to try out the new lifecycle stuff from google (https://developer.android.com/arch) but getting a crash on app open. All I have done is add the dependencies. Is anyone else having this problem?
日志:
FATAL EXCEPTION: main
Process: com.duetandroid.app.mock, PID: 17857
java.lang.NoClassDefFoundError: Failed resolution of: Landroid/arch/lifecycle/LifecycleDispatcher;
at android.arch.lifecycle.LifecycleRuntimeTrojanProvider.onCreate(LifecycleRuntimeTrojanProvider.java:35)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1751)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1726)
at android.app.ActivityThread.installProvider(ActivityThread.java:5853)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:5445)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5384)
at android.app.ActivityThread.-wrap2(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1545)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.arch.lifecycle.LifecycleDispatcher" on path: DexPathList[[zip file "/data/app/com.duetandroid.app.mock-1/base.apk"],nativeLibraryDirectories=[/data/app/com.duetandroid.app.mock-1/lib/x86, /data/app/com.duetandroid.app.mock-1/base.apk!/lib/x86, /system/lib, /vendor/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at android.arch.lifecycle.LifecycleRuntimeTrojanProvider.onCreate(LifecycleRuntimeTrojanProvider.java:35)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1751)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1726)
at android.app.ActivityThread.installProvider(ActivityThread.java:5853)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:5445)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5384)
at android.app.ActivityThread.-wrap2(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1545)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
build.gradle依赖项:
build.gradle dependencies:
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.android.support:preference-v14:25.3.1'
compile 'com.google.guava:guava:20.0'
compile 'com.google.code.findbugs:annotations:3.0.1'
compile 'com.sylversky.fontreplacer:fontreplacer:1.0'
compile 'com.github.barteksc:android-pdf-viewer:2.5.1'
compile 'commons-io:commons-io:2.5'
compile 'com.github.angads25:filepicker:1.1.0'
compile 'com.google.firebase:firebase-core:10.2.6'
compile 'com.google.firebase:firebase-crash:10.2.6'
compile 'android.arch.lifecycle:runtime:1.0.0-alpha1'
compile 'android.arch.lifecycle:extensions:1.0.0-alpha1'
annotationProcessor 'android.arch.lifecycle:compiler:1.0.0-alpha1'
compile 'android.arch.persistence.room:runtime:1.0.0-alpha1'
annotationProcessor 'android.arch.persistence.room:compiler:1.0.0-alpha1'
推荐答案
您使用Proguard吗?如果是这样,请尝试将其关闭:
Do you use Proguard? If so, try to turn it off:
debug {
minifyEnabled false
useProguard false
}
或者您可以将自定义规则添加到您的Proguard配置:
Or you can add custom rule to your Proguard config:
-keep class android.arch.** { *; }
这篇关于NoClassDefFoundError Landroid/arch/lifecycle/LifecycleDispatcher的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!