“Conversion to Dalvik format failed with error ...

In my Android application in Eclipse I get the following error.

UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: already added: Lorg/xmlpull/v1/XmlPullParser;
....
Conversion to Dalvik format failed with error 1

This error only appears when I add a specific external JAR file to my project. 

 

Solution:

Go to 

Project » Properties » Java Build Path » Libraries and remove all except the "Android X.Y" 

click OK. Go to 

Project » Clean » Clean projects selected below » select your project and click OK

That should work.

It is also possible that you have a JAR file located somewhere in your project folders (I had copied the Admob JAR file into my src folder) and THEN added it as a Java Path Library. It does not show up under the Package Explorer, so you don't notice it, but it does get counted twice, causing the dreaded Dalvik error 1.

 

 

 

IT-Homer 专栏

 

你可能感兴趣的:(“Conversion to Dalvik format failed with error ...)