java.lang.NoClassDefFoundError:android.support.v7.app.AppCompatDelegateImplV11

时间:2015-05-20 18:46:30

标签: java android android-support-library material-design

我使用我的App AppCompat进行材料设计。在继承自AppCompactActivity的onCreate of MainActivity类中显示以下错误之前,运行应用程序失败:

java.lang.NoClassDefFoundError: android.support.v7.app.AppCompatDelegateImplV11

目前,我的应用还使用了Facebook SDK和Google Play服务。我搜索了一个解决方案,我发现没有工作:(。有人可以帮助我感谢他。我留下完整的错误日志。

PD:我正在使用eclipse。

05-20 13:51:46.039: E/AndroidRuntime(23589): FATAL EXCEPTION: main
05-20 13:51:46.039: E/AndroidRuntime(23589): Process: com.tauro.videochat, PID: 23589
05-20 13:51:46.039: E/AndroidRuntime(23589): java.lang.NoClassDefFoundError: android.support.v7.app.AppCompatDelegateImplV11
05-20 13:51:46.039: E/AndroidRuntime(23589):    at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:77)
05-20 13:51:46.039: E/AndroidRuntime(23589):    at android.support.v7.app.AppCompatActivity.getDelegate(AppCompatActivity.java:414)
05-20 13:51:46.039: E/AndroidRuntime(23589):    at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:57)
05-20 13:51:46.039: E/AndroidRuntime(23589):    at com.tauro.MainActivity.onCreate(MainActivity.java:82)
05-20 13:51:46.039: E/AndroidRuntime(23589):    at android.app.Activity.performCreate(Activity.java:5990)
05-20 13:51:46.039: E/AndroidRuntime(23589):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
05-20 13:51:46.039: E/AndroidRuntime(23589):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)
05-20 13:51:46.039: E/AndroidRuntime(23589):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
05-20 13:51:46.039: E/AndroidRuntime(23589):    at android.app.ActivityThread.access$800(ActivityThread.java:151)
05-20 13:51:46.039: E/AndroidRuntime(23589):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
05-20 13:51:46.039: E/AndroidRuntime(23589):    at android.os.Handler.dispatchMessage(Handler.java:102)
05-20 13:51:46.039: E/AndroidRuntime(23589):    at android.os.Looper.loop(Looper.java:135)
05-20 13:51:46.039: E/AndroidRuntime(23589):    at android.app.ActivityThread.main(ActivityThread.java:5254)
05-20 13:51:46.039: E/AndroidRuntime(23589):    at java.lang.reflect.Method.invoke(Native Method)
05-20 13:51:46.039: E/AndroidRuntime(23589):    at java.lang.reflect.Method.invoke(Method.java:372)
05-20 13:51:46.039: E/AndroidRuntime(23589):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
05-20 13:51:46.039: E/AndroidRuntime(23589):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)

版:

Logcat full

05-20 13:51:42.944: I/art(23589): Rejecting re-init on previously-failed class java.lang.Class<android.support.v7.app.AppCompatDelegateImplV7>
05-20 13:51:42.945: I/art(23589): Rejecting re-init on previously-failed class java.lang.Class<android.support.v7.app.AppCompatDelegateImplV7>
05-20 13:51:42.945: I/art(23589): Rejecting re-init on previously-failed class java.lang.Class<android.support.v7.app.AppCompatDelegateImplV11>
05-20 13:51:42.946: I/art(23589): Rejecting re-init on previously-failed class java.lang.Class<android.support.v7.app.AppCompatDelegateImplV11>
05-20 13:51:42.947: I/art(23589): Rejecting re-init on previously-failed class java.lang.Class<android.support.v7.app.AppCompatDelegateImplV7>
05-20 13:51:42.947: I/art(23589): Rejecting re-init on previously-failed class java.lang.Class<android.support.v7.app.AppCompatDelegateImplV11>
05-20 13:51:42.948: I/art(23589): Rejecting re-init on previously-failed class java.lang.Class<android.support.v7.app.AppCompatDelegateImplV7>
05-20 13:51:42.948: I/art(23589): Rejecting re-init on previously-failed class java.lang.Class<android.support.v7.app.AppCompatDelegateImplV11>
05-20 13:51:42.949: D/AndroidRuntime(23589): Shutting down VM
05-20 13:51:46.039: E/AndroidRuntime(23589): FATAL EXCEPTION: main
05-20 13:51:46.039: E/AndroidRuntime(23589): Process: com.tauro.videochat, PID: 23589
05-20 13:51:46.039: E/AndroidRuntime(23589): java.lang.NoClassDefFoundError: android.support.v7.app.AppCompatDelegateImplV11
05-20 13:51:46.039: E/AndroidRuntime(23589):    at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:77)
05-20 13:51:46.039: E/AndroidRuntime(23589):    at android.support.v7.app.AppCompatActivity.getDelegate(AppCompatActivity.java:414)
05-20 13:51:46.039: E/AndroidRuntime(23589):    at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:57)
05-20 13:51:46.039: E/AndroidRuntime(23589):    at com.tauro.MainActivity.onCreate(MainActivity.java:82)
05-20 13:51:46.039: E/AndroidRuntime(23589):    at android.app.Activity.performCreate(Activity.java:5990)
05-20 13:51:46.039: E/AndroidRuntime(23589):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
05-20 13:51:46.039: E/AndroidRuntime(23589):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)
05-20 13:51:46.039: E/AndroidRuntime(23589):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
05-20 13:51:46.039: E/AndroidRuntime(23589):    at android.app.ActivityThread.access$800(ActivityThread.java:151)
05-20 13:51:46.039: E/AndroidRuntime(23589):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
05-20 13:51:46.039: E/AndroidRuntime(23589):    at android.os.Handler.dispatchMessage(Handler.java:102)
05-20 13:51:46.039: E/AndroidRuntime(23589):    at android.os.Looper.loop(Looper.java:135)
05-20 13:51:46.039: E/AndroidRuntime(23589):    at android.app.ActivityThread.main(ActivityThread.java:5254)
05-20 13:51:46.039: E/AndroidRuntime(23589):    at java.lang.reflect.Method.invoke(Native Method)
05-20 13:51:46.039: E/AndroidRuntime(23589):    at java.lang.reflect.Method.invoke(Method.java:372)
05-20 13:51:46.039: E/AndroidRuntime(23589):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
05-20 13:51:46.039: E/AndroidRuntime(23589):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)

2 个答案:

答案 0 :(得分:2)

我有同样的错误!它也没有给你明确的问题原因。真是太痛苦了。我花了一整天时间试图弄清楚它的修复方法。以下是我发现的内容 - Google Play服务是一个庞大的代码库。使用我使用的所有其他通用库,我达到65k方法的dex限制。这导致了我所犯的错误(也许也是你的错误)。

有关它的一些提示:

  1. 有选择地选择您要使用的Google Play服务。 onLast
  2. 如果这不起作用,请尝试对您的应用程序进行多索引。 Directions here。注意:如果遇到问题,请尝试扩展 MultiDexApplication而不是Application。
  3. 清理项目,重新启动Eclipse,和/或重新启动计算机。当它与上述dex问题无关时,这解决了类似的问题。

答案 1 :(得分:0)

将兼容性-v4 v21添加到您的构建中。

我将其添加为maven依赖项:

<dependency>
    <groupId>android.support</groupId>
    <artifactId>compatibility-v4</artifactId>
    <version>22.1.1</version>
</dependency>