Android ADT 14 Declares War on My Code!

The error comes up only when compiling the project, it started happening when I updated tools in Eclipse to ADT 14, but others had it in prior versions.

Unable to execute dex: Multiple dex files define

Conversion to Dalvik format failed with error 1
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: already added: Lcom/cyberwalkabout/common/DistanceUtils;




We have been using multiple project libraries for months, but now including them causes a problem as some of them are referenced more than once. 



SOLUTION is listed here: http://ukitech.blogspot.com/2012/06/javalangillegalargumentexception.html




Other problems encountered:

Updates (Android ADT 14) in Eclipse Indigo that introduced these problems:










switch() to if-then



Among many, many things that went wrong today this one was was annoying because of many places I had to change, but at least quick to fix.

Android ADT 14 decided that it does not like to use R.id.reference as a parameter to switch statement and it had to me changed to if-then.



So all of the switch statements had to be converted to if-then. Thankfully there is a shortcut for that (command-1).





3 comments:

  1. How did you resolve the error "Unable to execute dex: Multiple dex files define"

    ReplyDelete
  2. this error accounts when you reference a library more than once. Simple go to build path of the project and you can see,just remove one reference and here you go.

    ReplyDelete
  3. Similar problem solved:
    http://ukitech.blogspot.com/2012/06/javalangillegalargumentexception.html

    ReplyDelete