Unable to execute dex: Multiple dex files define

2019-01-01 06:53发布

I know this question has been asked here a few times before. But i haven't seen any possible solution yet. Before i make the project 'Run as Android Application' , if i do not clean it, i receive the following error and have to restart Eclipse ... and clean again.

Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define
     Lcom/jstun/core/attribute/MessageAttributeInterface;

com.jstun.core... is a part of my src folder, of course i can't remove it. And even if i remove that package, another package will show up as an error like:

Unable to execute dex: Multiple dex files define
     Landroid/support/v4/app/ActivityCompatHoneycomb;

I've seen this error since updating to ADT 15, i'm using Eclipse Galileo on Ubuntu Do you have any idea? Thanks for any reply!

标签: java android
30条回答
浪荡孟婆
2楼-- · 2019-01-01 07:39

For me I deleted android-support-v4.jar from lib folder and also removed from build path.

查看更多
骚的不知所云
3楼-- · 2019-01-01 07:40

Go to Project/properties and Java Built Path and unchecked the Android Private Libraries

查看更多
回忆,回不去的记忆
4楼-- · 2019-01-01 07:41

Well for me, I deleted the file in the libs folder called android support v4.jar and it all worked out. Goodluck :)

查看更多
其实,你不懂
5楼-- · 2019-01-01 07:42

The Solution for me was just to do following things:

  1. ->lib directory in your project and delete any multiple elements.
  2. Project->Properties->Java build Path and delete any Dependency Library was added automatically and not by you! ->Apply
  3. Restart Eclipse IDE
  4. Now Clean the project.
  5. Run/Debug on Device/Emulator the project ... Good Luck
查看更多
其实,你不懂
6楼-- · 2019-01-01 07:44

As others mentioned, this occurs when you have multiple copies of the same class in your build path, or elsewhere in your setup.

I had added android-support-v4.jar to my libs/ folder, and somehow eclipse added a second copy to bin/classes/android-support-v4.jar.

You can test for this with

grep -r YourOffendingClassName YourApp | grep jar

Deleting the extra copy in bin/classes solved the problem - unsure why Eclipse made a copy there.

查看更多
只靠听说
7楼-- · 2019-01-01 07:45

In case anyone else bangs their head on this issue like I just did:

My case involved a chain of library projects. Simply doing a project clean on all of the libraries fixed everything

查看更多
登录 后发表回答