Home » Android » android – Multiple dex files error when compiling with ant or Eclipse

android – Multiple dex files error when compiling with ant or Eclipse

Posted by: admin June 15, 2020 Leave a comment


I am unable to build my application
I am running the latest build tools downloaded today, this started happening after the update.

   [dex] Converting compiled files and external libraries into 
    [dx] com.android.dx.util.DexException: Multiple dex files define 

I have tried cleaning and rebuilding, I’ve also tried in Eclipse but it gives the same error.
Anyone got any ideas? I’m at a brick wall here now.

How to&Answers:

Something happened yesterday to my system (and another here at work) where the SDK wanted to push the platform tools update but then I was unable to use it at all, etc.

I ended up moving my SDK out of the way and reinstalling it, then everything worked as it always had. I did not have your dex specific issue, but I suspect the update push yesterday broke a good many things. Good luck.


I spent hours cleaning, creating new projects, uninstalling-reinstalling sdk… nothing worked. I didnt have any library project either ( i just had some jar files under lib). Howerver, In the end I fixed it and my steps were:

  • Search and clean all .apk files ( I had some in .svn folder…grr.. some developer had added some build related folders under svn)
  • delete bin and gen.
  • From eclipse project properties remove reference to library jars, press ok. Then again add them back. I had some java compiled jar library. I don’t know why I had to remove and add it back, but that surely was needed.


You can:

  • Delete folders <.settings>, <bin>, <gen>, and files <.classpath>, <.project> and <project.properties>.

  • Delete your project in Eclipse (right button, <Delete>) without deleting the source files.

  • Create a new Android project and select <Create project from existing sources> from your previous sources.

  • Import external libs, if needed in the build path.

It should solve this annoying problem.


Be very careful about all source files you attach to/have in your project.
I found this problem in two situations:

  1. When I have two different android support library jars
  2. When I accidently put in the past some Facebook src not as a library, but directly into my src directory

So all answers which says that you shouldn’t put your bin/ directory into class path are also correct, but in situation where you have error like:

[2013-08-02 20:22:03 - Dex Loader] Unable to execute dex: Multiple dex files define Lcom/facebook/android/AsyncFacebookRunner$1;
[2013-08-02 20:22:03 - Activity] Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Lcom/facebook/android/AsyncFacebookRunner$1;

you should look for same jars in project/libraries (this should be founded by Android Eclipse environment in most cases) or look into all sources attached to project to find multiple occurance of (as in example code above) of class com.facebook.android.AsyncFacebookRunner


I think the directory in bin change from




You can clean your project and solve it.


I was seeing this same problem. If you’re using Android Studio, you need to make sure you don’t have the ‘bin’ or ‘gen’ folders included in any of your projects when you’re compiling.

After removing this I was able to compile successfully


If you’re having issues because of Multiple DEX files

Remove the entire target folder and build the project again. This won’t affect your project cause everything in the target folder is built again.


Change implementation fileTree(include: [‘.jar’], dir: ‘libs’) to
provided fileTree(include: [‘
.jar’], dir: ‘libs’) in your app gradle.build> dependencies.

Make sure it has changed in your Module Settings> Dependencies {include=[*jar] dir=libs} too. It must have a scope of Provided next to it and not Implementation.