I want to export an apk for the project but each time i export i got an error saying Conversion to Dalvik format failed with error 1. I faced this error before while working on same project and when i get it I go to the project folder and delete jars from folder classes inside folder bin but in Exporting APK It doesn't work Can anyone help me ?
-
[Have you tried this](http://www.google.com/search?q=Conversion+to+Dalvik+format+failed+with+error+1+-+Exporting+APK&ie=utf-8&oe=utf-8&aq=t) – Praveenkumar Aug 09 '12 at 12:13
-
I tried but I am using MAC not windows – Mohamed Naguib Aug 09 '12 at 12:20
-
[Have a look at this video tutorial](http://www.youtube.com/watch?v=4JXGbvgJnSc) – Praveenkumar Aug 09 '12 at 12:27
-
It didn't help I know how to export and import but I don't know how to fix that error – Mohamed Naguib Aug 09 '12 at 12:32
3 Answers
Generally my experience with 'Conversion to Dalvik format failed with error 1' is that you need to do a project clean (if you use eclipse them from menu Project -> Clean ... ) this usually fixes the problem. Also right click on the project you want to export then Properties -> Android Tools -> Fix Project properties.
If this doesn't help you then with terminal go to the project path
cd /home/username/your_project_path
then
rm -fr bin/*
Note: you may need to restart eclipse or at least select the project and refresh it (F5).
Hope this will help you, if still doesn't , please let me know

- 31,523
- 64
- 157
- 244
-
I am gonna help you with something special in my case. I create a folder called libs inside project and import jars using file system then right click on this folder and configure build path then " Add Jars" not "Add External Jars" – Mohamed Naguib Aug 09 '12 at 12:48
-
This always lead to 2 copies of JARS one copy inside folder called libs in the project and other copy inside folder classes inside folder bin in the project – Mohamed Naguib Aug 09 '12 at 12:50
-
still getting same error because of 2 copies of JAR files. can you help to have only 1 copy – Mohamed Naguib Aug 09 '12 at 13:25
-
remove all the jar files, then add them from start, and why do not you try add external jars ? with out creating folders by your own – Lukap Aug 09 '12 at 13:44
I solved this problem
- 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.
If you have a JAR file located somewhere in your project folders 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 Dalvik error 1.

- 527
- 5
- 6
You guys don't have to remove libraries at all.
Yes, the problem is caused by the libraries.
BUT!!! What if you need the libraries to build? It doesn't make sense.
I had a same problem, and finally got the solution.
Add exceptions in the "proguard-project.txt" file having proguard config.
like this
-dontwarn android.support.**
That's it.
1) check what you have libraries on the project. check package name! not file name! see the list below "Android Dependencies". when you click "*.jar", you can see the package names in the jar file.
Assuming that you have "aaa.jar". the jar have "org.jdesktop.application", "org.jdesktop.swingworker"
(Project) > Android Dependencies > aaa.jar > org.jdesktop.application
> org.jdesktop.swingworker
2) just add like below
-dontwarn org.jdesktop.**
into the (Project) > proguard-project.txt file.

- 2,241
- 1
- 19
- 8