【问题标题】:Multiple dex files define Lcom/nineoldandroids/animation/Animator$AnimatorListener多个dex文件定义Lcom/nineoldandroids/animation/Animator$AnimatorListener
【发布时间】:2018-01-23 20:08:33
【问题描述】:

有多个问题可以解决这个问题..但没有一个对我有用..

我正在使用两个库 Jazzy view pagermpAndroidChartLibrary jazzyViewPager 是一个库项目,而 androidChartLibrary 是一个 jar 文件

当我尝试运行项目时出现以下错误

[2015-03-03 11:27:02 - Dex Loader] Unable to execute dex: Multiple dex files define Lcom/nineoldandroids/animation/Animator$AnimatorListener;
[2015-03-03 11:27:02 - chart] Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Lcom/nineoldandroids/animation/Animator$AnimatorListener;

我已经反复清理项目并重新启动eclipse和系统..但错误仍然存​​在

根据建议我做了以下

  • 右键单击项目名称
  • 选择构建路径->配置构建路径
  • 在 Java Build Path 中,转到选项卡 Order and Export
  • 取消选中 Android 私有库

在此之后应用程序运行.. 但随后发生以下 dalvikvm 异常

 Unable to resolve superclass of Lcom/example/chart/MainActivity; (30)
 Link of class 'Lcom/example/chart/MainActivity;' failed
 threadid=1: thread exiting with uncaught exception (group=0x40e19540)

之后发生 Class not found 异常..

  java.lang.RuntimeException: Unable to instantiate activity ComponentInfo 
 {com.example.chart/com.example.chart.MainActivity}: 
 java.lang.ClassNotFoundException: com.example.chart.MainActivity

    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2271)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2391)
    at android.app.ActivityThread.access$600(ActivityThread.java:151)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1335)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:155)
    at android.app.ActivityThread.main(ActivityThread.java:5520)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1029)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:796)
    at dalvik.system.NativeStart.main(Native Method)
  Caused by: java.lang.ClassNotFoundException: com.example.chart.MainActivity
    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
    at android.app.Instrumentation.newActivity(Instrumentation.java:1069)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2262)
    ... 11 more

我的清单是正确的.. 以前可以工作 b4 添加图表 jar.. 当我删除它时它可以工作..

【问题讨论】:

  • 您包含nineoldandroids 两次。
  • @Wesley 在哪里??我没有得到你..
  • Jazzy view pagermpAndroidChartLibrary 是您在项目中使用的仅有的两个库吗? Jazzy view pagermpAndroidChartLibrary 是否使用了库 nineoldandroids?如果是这样,你应该排除它。
  • @Wesley 在私有库中有一个 Nineoldandroids 2.4.0.jar 和 mpAndroidChartLibrary .jar 和 supportv4 ,除了库中的 supportv7 之外还有 mpAndroidChartLibrary .jar 和 supportv4
  • @Wesley 是的,他们是 .. 并且都是 Nineoldandroids.. 那么我该如何排除他们>???

标签: android eclipse dex nineoldandroids lcom


【解决方案1】:

如果您尝试了其他方法来确保您的 build.gradle 中没有任何不同的冲突版本的库,但它仍然没有为您工作,这意味着“nineoldandroids”库是一个巨大的库,其中包含其他不可见的较小库与您的其他模块中的依赖项冲突导致此问题..

这是如何解决它..

  1. 确定包含“nineoldandroids”库的 build.gradle..
  2. 将其更改为“仅编译文件”..

  3. 清理并重建项目...

这将防止它向您项目中的其他模块泄漏依赖项,从而阻止这些无形的冲突...

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-05-22
    • 2016-11-06
    • 1970-01-01
    • 1970-01-01
    • 2013-01-22
    • 2018-07-01
    • 2018-01-15
    相关资源
    最近更新 更多