25

I was programming an application for android, after i added a tab layout to the program an error showed up to:

Conversion to Dalvik format failed with error 1

I have tried cleaning the project and looking at all the other solution to the problem on this website. Has someone also found some obscure solution to this error?

Moog
  • 10,193
  • 2
  • 40
  • 66
YoKaGe
  • 385
  • 2
  • 7
  • 15

13 Answers13

19

Please see this thread "Conversion to Dalvik format failed with error 1" on external JAR

more information here: Reason of Conversion to dalvik format failed with error 1

Community
  • 1
  • 1
Vector
  • 359
  • 2
  • 6
  • One of the solutions that came up on the second link was to delete the project and then import it back – YoKaGe Jul 13 '11 at 20:45
  • How would i do that exactly because if i delete it than how can i import it – YoKaGe Jul 13 '11 at 20:46
  • You can move the project's folder to another location outside your eclipse workspace, then create a new project with the same name and import each class and xml file one by one. It would be a pain, but may be the only fix. Have you tried removing the layout file with the tab view and see if the error goes away? – Vector Jul 15 '11 at 23:16
  • For me the issue was Proguard and was caused by adding this line: -keepattributes ** So that was probably not the ultimate root cause but definitely caused the problem and removing it fixed the problem. – Fraggle Aug 29 '12 at 16:21
  • Problem with Proguard. Removed it and problem resolved. – Smeet Apr 04 '15 at 04:07
14

For those of you reaching here in the last days (see this post date), the last upgrades to ADT 14 have been causing every android project which uses an android library project to fail building with that error. I've tried this solution and it worked for me.

Tu sum it up, if you are using android library projects:
Package Explorer, right-click->Remove From Build Path (ok to unlink), on all the XXX_src in your projects of your workspace.

mamuso
  • 3,117
  • 3
  • 30
  • 32
9

Windows 7 Solution if you are obfuscating with ProGuard:

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
Noah
  • 15,080
  • 13
  • 104
  • 148
5

Upgrade your Proguard to its latest version i.e., 4.7... Dowload the zip from http://sourceforge.net/projects/proguard/files/latest/download?source=files .... then copy the "lib" and "bin" folders from the zip to your sdk/tools/proguard/ to replace the default or say old "bin" and "lib" .... try exporting your project once again...

Achin Kumar
  • 777
  • 6
  • 11
4

I was getting this because I had manually added android.jar to the build libraries because it was saying it wasn't finding the android libraries. The fix was to...

  1. Remove android.jar from the build libraries

  2. Right click on the project, go to "Android Tools", and select "Fix Project Properties"

Hope this helps.

Gaʀʀʏ
  • 4,372
  • 3
  • 39
  • 59
3

If you are using Android SDK tools revision 12, check this link: Android SDK tools revision 12 has problem with Proguard => error conversion to Dalvik format failed with error 1

Simply cleaning, reimporting, removing libs won't work! Replacing tools directory with v11 was the only solution for me!

Community
  • 1
  • 1
Mr. D
  • 101
  • 5
  • I had the same issue. Updating to Proguard 4.6 solved the problem (I also edited the batch files, though it seemed to work even without doing that). – Sven Viking Aug 26 '11 at 17:41
2

delete <classpathentry kind="lib" path="libs"/> from .classpath file.

this works for me.

McDowell
  • 107,573
  • 31
  • 204
  • 267
Savas Adar
  • 4,083
  • 3
  • 46
  • 54
2

Had same problem after upgrade to Eclipse Indigo. The whole errors list started with

 [dx] java.lang.IllegalArgumentException: already added: <some library>;

and ended with

  Conversion to Dalvik format failed with error 1

The solution:

  • Right-click on project and select "Properties"
  • Select "Java Build Path" on left tree
  • Select "Library" tab on top
  • You will, probably see this library in the list (it is not jar, but Library!, the jar is below)
  • Delete it.
Julia
  • 21
  • 2
1

i had the same problem and spent a lot of time trying everything i could, so the only way that worked for me was upgrading ADT to the latest version. So if nothing from the top helps to you just go Help->"Check for Updates".

Ezeki
  • 149
  • 1
  • 2
1

This issue comes due to some conflicts in the jar which you might have added in the class path. Try removing the specific jar (hit and trail) and see if the error goes off.

user976873
  • 11
  • 1
0

While setting up the DropBox example app, I encountered this error.

The solution was to remove all JAR files from the build path, delete everything inside /libs, paste the required JAR files back in, and add them to the build path again.

Andrew Calder
  • 451
  • 4
  • 8
0
Removed all the projects from workspace
Import projects back
Clean 

worked !

kakopappa
  • 5,023
  • 5
  • 54
  • 73
0

Two easy steps:

  1. CLEAN
  2. BUILD
Jayson Tamayo
  • 2,741
  • 3
  • 49
  • 76