Eclipse, Android: Unexpected Unable to execute dex: Multiple dex files define

放肆的年华 提交于 2019-12-07 01:56:22

问题


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..


回答1:


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




回答2:


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..




回答3:


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!




回答4:


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. :)




回答5:


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.




回答6:


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.



来源:https://stackoverflow.com/questions/26089572/eclipse-android-unexpected-unable-to-execute-dex-multiple-dex-files-define

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!