1

Im trying to embedd this library in my android project. I did very little, as said in their wiki, added the gradle compile line compile 'com.nhaarman.listviewanimations:library:2.6.0' Then, Created the adapter as said. I get this error:

Error:Execution failed for task ':app:dexDebug'.

com.android.ide.common.internal.LoggedErrorException: Failed to run command: /Applications/Android Studio.app/sdk/build-tools/19.1.0/dx --dex --num-threads=4 --output app/build/intermediates/dex/debug app/build/intermediates/classes/debug app/build/intermediates/dependency-cache/debug app/build/intermediates/pre-dexed/debug/classes-4a718e9bccae9ae73111e208543c09e4aca23f24.jar app/build/intermediates/pre-dexed/debug/classes-65552ddd9b835cec189dfdc89d020dd1d4a05efa.jar app/build/intermediates/pre-dexed/debug/classes-98d7ab0cdd3d33cece8c7361f5d1834b474bc2d3.jar app/build/intermediates/pre-dexed/debug/classes-a29a6155c296912b05b7b0750843b61b39e9097a.jar app/build/intermediates/pre-dexed/debug/classes-b575f5f3eb7608b6d45a001c7473ced02311e5d7.jar app/build/intermediates/pre-dexed/debug/classes-c0baed271e3d073b9c85c0c02747be63142fb326.jar app/build/intermediates/pre-dexed/debug/classes-debf6a19b9bb7e125665b9467f9f225457142b89.jar app/build/intermediates/pre-dexed/debug/gson-2.2.4-d931d9a27db6fa844edcb42f0c8ab871054b10b0.jar app/build/intermediates/pre-dexed/debug/library-2.4.0-bda29182e67fb41a3da3dde6a9cf7ba7254190ac.jar app/build/intermediates/pre-dexed/debug/library-2.6.0-09d4145fc0c719919bdb7fe432f3a97be8e0e47e.jar app/build/intermediates/pre-dexed/debug/nineoldandroids-2.2.0-872ce4d9aeb3ff50a99b031a1ad9d52170caf747.jar app/build/intermediates/pre-dexed/debug/support-v4-19.1.0-fe930dc68beb1e566675ce71b270d4091c6c249b.jar Error Code: 2 Output: UNEXPECTED TOP-LEVEL EXCEPTION: com.android.dex.DexException: Multiple dex files define Lcom/nineoldandroids/animation/Animator$AnimatorListener; at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:594) at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:552) at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:533) at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:170) at com.android.dx.merge.DexMerger.merge(DexMerger.java:188) at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:439) at com.android.dx.command.dexer.Main.runMonoDex(Main.java:287) at com.android.dx.command.dexer.Main.run(Main.java:230) at com.android.dx.command.dexer.Main.main(Main.java:199) at com.android.dx.command.Main.main(Main.java:103)

I also tried to do gradlew clean assembleDebug in my project's directory, but it didnt help. Any suggestions what I should do?

buddy123
  • 5,679
  • 10
  • 47
  • 73

1 Answers1

6

The problem is that you have at least two libraries included in your project using nineoldandroids library but one of them is using the jar file in the libs folder of your project while the other is referencing it somewhere else probably Maven.

So the solution is to remove the jar file from your libs folder and delete the following line from build.gradle

compile files('libs/nineoldandroids-2.4.0.jar')
Saba Jamalian
  • 750
  • 2
  • 10
  • 24
  • 2
    After scratching my head for more than a day, deleting all the `jar`s in the app directory and just referring to the module helped. Thanks a lot :) – Aman Alam Dec 25 '14 at 14:29