Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple dex files error when compiling with ant or Eclipse

Tags:

android

dex

ant

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

-dex:
   [dex] Converting compiled files and external libraries into 
         /Users/rob/Repos/my_app/bin/classes.dex...
    [dx] 
    [dx] UNEXPECTED TOP-LEVEL EXCEPTION:
    [dx] com.android.dx.util.DexException: Multiple dex files define 
         Lcom/robaldred/myapp/About$1;

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.

like image 887
Rob Avatar asked Oct 21 '11 18:10

Rob


1 Answers

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.
like image 140
Mazed Avatar answered Sep 25 '22 12:09

Mazed