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!
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-v4library to get Ice Cream Sandwich support instead of the Honeycomb support library.
I have encountered a similar error today and the reason was that the support library was referenced by two library projects used by my app project but with different versions.
In more details:
My app depends on 2 library projects
- FaceBookSDK 3.0 -> which is referencing android-support-v4
- ActionBarSherlock -> which is referencing android-support-v4 but with a modified version to support maps.
To solve the problem I had to make FaceBookSDK library depend on ABS library instead of the support library directly.
Well for me, I deleted the file in the libs folder called android support v4.jar and it all worked out. Goodluck 🙂
I had the same error happening and every time I fixed it, it would come back after I restarted Eclipse.
First of all, as other people said, make sure you do not have multiple copies of the same .jar file around your projects.
In my case, I had a main project that used ActionBarSherlock (among other library projects). The trick that worked for me was going into
ActionBarSherlock --> Properties --> Java Build path --> Order of Export and unselecting
Android Private Libraries. Then going into
Project -> Clean and now you should be able to build the project correctly.
Now, for some reason, every time I restart Eclipse, it automatically enables that checkbox, so I have to repeat this process again.
Hope this helps some lost soul out there 🙂
Go to Project/properties and Java Built Path and unchecked the Android Private Libraries
To me, just go to Project Properties >> Java Build Path >> Order and Export. Uncheck all external library, as the image bellow. It work for me. Hope this help.
I have also faced this problem in my project. AVD is not able to reload assets,lib,res and etc folder contexts.
Dex Loader] Unable to execute dex: Multiple dex files define
Then,I created new projects and copied
activity_main.xml, drawable context.
Then delete old project from package explore,restart your Eclipse and AVD.
My project is now working properly…. 🙂
I hope this steps will help u little bit folks..!!
I have same issue, what i tried is:
- List item
- Open Project Build Path,
- Select “Libraries” tab,
- Remove all library except the Android Library
- Adding all required JARs Files,
- And Done!
It works for me, thanks.
If some of you facing this problem with facebook-connent-plugin for phonegap
try to remove files in bin/class/com/facebook/android directory ! -> and rebuild
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.
I got this error for another reason. I was mistaking adding both the v4 AND the v13 support library. This was not necessary for me since my minSdkVersion is 15.
I fixed it by only including the v13 support library. Also, make sure to check mark the library in your exported library build path in eclipse. I also moved it to the top.
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.
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.
The Solution for me was just to do following things:
- ->lib directory in your project and delete any multiple elements.
- Project->Properties->Java build Path and delete any Dependency Library was added automatically and not by you! ->Apply
- Restart Eclipse IDE
- Now Clean the project.
- Run/Debug on Device/Emulator the project …
My problem at first was:
Unable to execute dex: java.nio.BufferOverflowException. Check the Eclipse log for stack trace.
1) I Right click on my project -> Android Tools -> Add Support Library
(Run my app…Didn’t work so I keep it going…)
2) Right click on my project again -> Properties -> Android -> Check Android 4.1.2 (16) on Project Build Target
(Run the app again…and get this:
Unable to execute dex: Multiple dex files define Landroid/support/v4/app/BackStackState;
3) So I went to the “lib” folder on my project and delete the “old” Android.support.library.jar
(Run the app and cross fingers and…)
Hope it helps someone…Thanks people!
I have had this issue and that doesn’t mean, that the same library is loaded many times but System is trying to load a class with the same name and possibly same package name simultaneously, i.e.
How should you approach?
You should analyze which methods are being used, a method of library1.jar or library2.
There are 2 Solutions,
- Rename a packagename and then dalvik interprets, that they are distinct classes
- Or if you want to risk, purge the class, which doesn’t contain the methode, which we really use.
I hope that has clarified this often asked question.
I removed Android dependencies from build path and it worked.
This error happened to me when in my app’s project I referenced a Library project in my Eclipse workspace (in my case the Facebook SDK) and at the same time included the Facebook SDK as a jar in the libs folder. Removing the library reference but keeping the jar in the libs folder removed the error.
I had same problem. I had to delete the
.apk file and then it worked.
For me I deleted android-support-v4.jar from lib folder and also removed from build path.
- Right click on project and go to
build Path>configuration build path
- Select library tab and click on
support-v4 libraryand click on remove
- Click on OK
and then clean your project and run it will work 🙂
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
I found below solution in eclipse…hope it works for you 🙂
Right click on the Project Name Select Java Build Path, go to the tab Order and Export Unchecked your .jar library's
This problem occurs when a same library is added into your project multiple times. If you haven’t added the library multiple times intentionaly, check out the dependency/private libraries of the libraries you have added in your project, most probably they have already included a library which is causing this conflict.
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.
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.
For me the issue was that, i had added a lib project(autobahn lib) earlier and later switched the to Jar file of the same library.Though i had removed references to the older library project, i was getting this error.
Following all the answers here i checked the build path etc. But i haven’t added these libs to build path manually. So i had nothing to remove.
Finally came across this folder.
I noticed that there were two jar files with the same name corresponding to autobahn Android which was causing the conflict. So i deleted all the jar files in the dexedLibs folder and rebuild the project. That resolved the issue.
To add the myriad of other potential sources… I had updated all the libraries in my project’s
lib folder but then Eclipse “helpfully” reinstalled all the original libraries. There was no longer any reference inside Eclipse to these libraries but the external dex-maker program just grabbed all the files in the
lib directory and thus got two versions of several library
git status identified the new files and
git clean -f got rid of them for me (though I sometimes had to wait or restart Eclipse on Windows because it still had the files open from the copy).
ULTRA simple solution and finest:
Remove everything in Right Click Main Project’s Folder -> Properties -> Java Build Path except Android X.Y (where X.Y is the version in android). Clean, and Build. Done!
Make sure before of that to have a single android-support-v4.jar.
If you are using cordova, try cordova clean command