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:25

I had this problem in Intellij and it was because the ActionBarSherlock library I added to my project defined the android-support-v4.jar as a compile dependency and this jar was already included in my project so there were multiple copies/version of DEX at compile time.

The solution was to change the ActionBarSherlock module dependency for this jar to be Runtime instead of compile, as my project was already providing it.

查看更多
十年一品温如言
3楼-- · 2019-01-01 07:25

I'm leaving this answer for someone who gets in this scenario as I did.

I stumbled here and there before noticing that I mistakenly dragged and dropped the Support Library JAR file into my src folder and it was lying there. Since I had no idea how it happened or when I dropped it there, I could never imagine something was wrong there.

I was getting the same error, I found the problem after sometime and removed it. Project is now working fine.

查看更多
残风、尘缘若梦
4楼-- · 2019-01-01 07:26

This is a build path issue.

  • Make sure your bin folder is not included in your build path.

  • Right click on your project -> go to properties -> Build Path.

  • Make sure that Honeycomb library is in your libs/ folder and not in your source folder.

  • Include the libraries in libs/ individually in the build path.

    BTW, you may want to bring in the android-support-v4 library to get Ice Cream Sandwich support instead of the Honeycomb support library.

查看更多
伤终究还是伤i
5楼-- · 2019-01-01 07:26

Even after going through multiple answers, no solution worked for me.

I deleted "Android Dependencies" from the build path. Added all the jar files again to the build path and the error was gone. Somehow eclipse seemed to cache the things.

查看更多
十年一品温如言
6楼-- · 2019-01-01 07:27

I was also struggling to find this is issue. In my case what happened is while copying the apk to email (drag drop) - by mistake the apk was pasted in src folder in one of the packages. After removing the apk from source folder it worked fine.

查看更多
裙下三千臣
7楼-- · 2019-01-01 07:28

I had same problem. I had to delete the .apk file and then it worked.

查看更多
登录 后发表回答