0
votes

"Conversion to Dalvik format failed with error 1" continuously appears and tried several answer threads including this one too.
"Conversion to Dalvik format failed with error 1" on external JAR
Below is the project structure.

project structure


The problem is with the "xerces.jar". When it is removed from "libs" folder the project can be run successfully, but without the .jar file, application can't be run as exceptions occur. What should I do?

2
have you tried to clean project?Muhammad Babar

2 Answers

1
votes

You need to add your xerces.jar file to as a Referenced libraries. For that use

 Project -> Right Click ->Properties -> Java Build Path -> Libraries ->Add External Jars.

Then also add to your libs folder too.

Unchecked your Android Private Libraries and Android Dependencies in Order and Export Menu. Finally run your project and build it.

1
votes

The reason you get this error is because you have multiple java files with the same package and class name(same FQN).

(Rare) If you have the same file in two separate jars then you are in for a ride of manipulating these jars.

(Common) If you have jar in the lib folder, don't add them to the classpath manually as the ADT adds them to the classpath via this line

<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>

This way you only need to check the export of the libraries node in the classpath tab.