6

The problem: I can't built my project. When I try the following sign is shown in the Console:

[2014-09-28 23:49:30 - Dex Loader] Unable to execute dex: Multiple dex files define Landroid/support/annotation/AnimRes;
[2014-09-28 23:49:30 - Shop] Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Landroid/support/annotation/AnimRes;

I lost hours of searching for a solution for this problem, but no result.. I tried to clean the project, to delete the bin folder etc. but nothing worked..

Please, help, I don't know what to do..

dephinera
  • 3,703
  • 11
  • 41
  • 75
  • Try all the [solutions mentioned in this SO question](http://stackoverflow.com/questions/8059719/unable-to-execute-dex-multiple-dex-files-define) – ashoke Sep 29 '14 at 10:38

6 Answers6

8

Remove android-support-annotations.jar from libs folder. As these annotations are already included in recent versions of the android-support-v4.jar file.

anurag_dake
  • 988
  • 13
  • 15
5

I couldn't fix it so I ended up by creating new project in a different workspace and copied all the code to the new project. It's not the smartest thing but what can I do..

dephinera
  • 3,703
  • 11
  • 41
  • 75
2

I lost several hours too in this problem but i think that I found a solutión, at least for my. Andoid Studio said me that i had "Multiple dex files define Landroid/support/annotation/AnimRes;" but he said also had a file call inputList.txt that had a bug. Well, i found this file in directory tree and i found in app/build/intermediates/tmp/dex/debug folder. The file is a simple textfile that had one row for each dependence as support-annotations or androidplot-core with a absolute path.

I saw several row repeated and i thought that if i remove i solve the problem, but it didn't work.

Then I searched this route and all .jar are in the same place: app/build/intermediates/pre-dexed/debug/ folder, and I saw repeated .jar files and I removed this, after i went to the file and I erased repeated rows too.

Then I run my project and the bug disappeared, the problem it solved.

The problem was then: .jar files duplicated in that folder.

Easy!

Juan Antonio
  • 2,451
  • 3
  • 24
  • 34
1

I have same problem. I think it was happen because there are modification in bin folder contents when I update project repository with tortoise SVN. I have removed bin, and Eclipse generate new one but the problem still persist. But I resolved problem by removing android dependency library. Here the steps :

Select Project -> Right Click -> Select Build Path -> Configure Build Path -> In Libraries tab remove Android Dependencies -> OK. Then clean the project and run again. :)

arif ardiansyah
  • 517
  • 4
  • 7
  • 3
    Sorry, I deleted my comment. In my case, android-support-v4 was the problem. My Project has android-support-v4 and AppCompat both. So, I removed support-v4 and did cleaned. And the error was disappeared. :) – cmcromance Nov 14 '14 at 01:19
0

Remove the library which contains android-support-v4.jar,then add the android-support-v4.jar to buid path direct. By the way,I use Eclipse for IDE.

HCOOL
  • 11
0

As the console output said "Multiple dex files define".

Under ther bin/dexedLibs, there many jars with the same name but of different version.

I solve it by remove all the duplicated support v4 jars under all the lib folders and make my main project reference to the single one in the library project, then clean the project to rebuild.It works as a charm now.

Linyun Liu
  • 721
  • 6
  • 7