多个dex文件定义Lcom / nineoldandroids / animation / Animator $ AnimatorListener

时间:2015-03-03 06:07:51

标签: android eclipse dex nineoldandroids lcom

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

我正在使用两个库 Jazzy view pager mpAndroidChartLibrary 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 ..当我删除它时它会起作用..

1 个答案:

答案 0 :(得分:0)

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

这是如何解决它..

  1. 识别包含" nineoldandroids"的build.gradle。图书馆..
  2. 将其更改为" compileOnly files" ..

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

  4. 这样可以防止它将依赖项泄露给项目中的其他模块,从而阻止这些不可见的冲突......