Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Conversion to Dalvik format failed with error 1" on external JAR

Go to Project » Properties » Java Build Path » Libraries and remove all except the "Android X.Y" (in my case Android 1.5). 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.

Another possible reason could be package name conflicts. Suppose you have a package com.abc.xyz and a class named A.java inside this package, and another library project (which is added to the dependency of this project) which contains the same com.abc.xyz.A.java, then you will be getting the exact same error. This means, you have multiple references to the same file A.java and can't properly build it.

In other ways this may be occurred if you accidentally or knowingly edit/ add any thing in the class path file manually .In certain cases we may add android.jar path manually to classpath file for generating java doc.On removing the that after javadoc generated code will works fine.Please check this too if any one still occurs.


I solved the problem.

This is a JAR file conflict.

It seems that I have two JAR files on my buildpath that include the same package and classes.

smack.jar and android_maps_lib-1.0.2

Deleting this package from one of the JAR files solved the problem.


Windows 7 Solution:

Confirmed the problem is caused by ProGuard command line in the file
[Android SDK Installation Directory]\tools\proguard\bin\proguard.bat

Edit the following line will solve the problem:

call %java_exe% -jar "%PROGUARD_HOME%"\lib\proguard.jar %*

to

call %java_exe% -jar "%PROGUARD_HOME%"\lib\proguard.jar %1 %2 %3 %4 %5 %6 %7 %8 %9

You can solve this issue easily (with Eclipse Android Developer Tools, Build: v22.0.1-685705) by turn off menu > "Project" > "Build Automatically" while exporting (un)signed Android application. After that, don't forget to turn it on again.


If you have ADT revision 12+, you should update your proguard from 4.4 -> 4.6 (as described here). Also, you should leave ...\bin\proguard.bat file in the orginal form.

Just download it from the web, and copy lib folder from downloaded package to the :

[Android SDK Installation Directory]\tools\proguard\lib