Multiple dex files define Lcom/nineoldandroids/animation/Animator$AnimatorListener

1.8k Views Asked by At

There are multiple questions that address this problem.. but none have worked for me..

I am using two libraries Jazzy view pager and mpAndroidChartLibrary The jazzyViewPager is a library project wheras androidChartLibrary is a jar File

I am getting the following error when I try to run the project

[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;

I have repeatedly cleaned the project and restarted eclipse and the system.. But still the error remains

According to suggestions I did the following

  • Right click on the Project Name
  • Select Build Path -> Configure Build Path
  • In Java Build Path, go to the tab Order and Export
  • Uncheck Android Private Libraries

after this the app runs.. but then the following dalvikvm exception occurs

 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)

afterwards a Class not found exception occurs ..

  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

My manifest is correct.. that used to work b4 adding the chart jar.. and it works when i remove it..

1

There are 1 best solutions below

0
On

Incase you have tried the other methods of making sure you do not have any different conflicting versions of libraries in your build.gradle and it still hasn't worked for you, it means "nineoldandroids" library is a huge library that contains other invisible smaller libraries which are conflicting with dependencies in your other modules to cause this problem..

This is how to solve it..

  1. Identify the build.gradle which contains "nineoldandroids" library..
  2. Change it to "compileOnly files" ..

  3. Clean and rebuild the project...

This will prevent it from leaking dependencies to other modules in your project, thereby stopping these invisible conflicts...