Wednesday, October 26, 2011

Conversion to Dalvik format failed with error 1

Things I tried to fix this error (reference 1) which appeared when I tried to export a signed package:

  1. Fix Project Properties
    -> no effect
  2. Clean Build
    -> no effect
  3. SVN Cleanup
    -> no effect
  4. eclipse.exe -clean
    -> no effect
  5. changed project target to ICS (Android 4.0)
    -> no effect
  6. deleted "bin" directory
    -> a different exception appeared.. (reference 2) :o
  7. Clean Build
    -> back to the old exception (reference 1)
  8. Try to export another project's signed apk
    -> same error
  9. switch build output from "silent" to "verbose"
    -> new exception... (reference 3)
  10. edited eclipse.ini: -Xmx750m (before it was 512m)
    -> exception (reference 3)
  11. switch build output back to "silent"
    -> success!!! =D
Looks like I was running short on memory. :-)

** Environment:
Windows 7 32bit / Eclipse 3.5.2/ ADT 14


Reference 1 (the first exception):
org.eclipse.core.runtime.CoreException: Conversion to Dalvik format failed with error 1
 at com.android.ide.eclipse.adt.internal.project.ExportHelper.exportReleaseApk(ExportHelper.java:249)
 at com.android.ide.eclipse.adt.internal.wizards.export.ExportWizard.doExport(ExportWizard.java:290)
 at com.android.ide.eclipse.adt.internal.wizards.export.ExportWizard.access$0(ExportWizard.java:229)
 at com.android.ide.eclipse.adt.internal.wizards.export.ExportWizard$1.run(ExportWizard.java:214)
 at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
Caused by: com.android.ide.eclipse.adt.internal.build.DexException: Conversion to Dalvik format failed with error 1
 at com.android.ide.eclipse.adt.internal.build.BuildHelper.executeDx(BuildHelper.java:740)
 at com.android.ide.eclipse.adt.internal.project.ExportHelper.exportReleaseApk(ExportHelper.java:204)
 ... 4 more


Reference 2 (exception that appeared after deleting "bin" directory):
org.eclipse.core.runtime.CoreException: Failed to export application
 at com.android.ide.eclipse.adt.internal.project.ExportHelper.exportReleaseApk(ExportHelper.java:255)
 at com.android.ide.eclipse.adt.internal.wizards.export.ExportWizard.doExport(ExportWizard.java:290)
 at com.android.ide.eclipse.adt.internal.wizards.export.ExportWizard.access$0(ExportWizard.java:229)
 at com.android.ide.eclipse.adt.internal.wizards.export.ExportWizard$1.run(ExportWizard.java:214)
 at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
Caused by: java.util.zip.ZipException: ZIP file must have at least one entry
 at java.util.zip.ZipOutputStream.finish(ZipOutputStream.java:304)
 at java.util.zip.DeflaterOutputStream.close(DeflaterOutputStream.java:146)
 at java.util.zip.ZipOutputStream.close(ZipOutputStream.java:321)
 at com.android.ide.eclipse.adt.internal.project.ExportHelper.exportReleaseApk(ExportHelper.java:176)
 ... 4 more


Reference 3 (exception that appeared when build output was changed to "verbose"):
org.eclipse.core.runtime.CoreException: Failed to export application
 at com.android.ide.eclipse.adt.internal.project.ExportHelper.exportReleaseApk(ExportHelper.java:255)
 at com.android.ide.eclipse.adt.internal.wizards.export.ExportWizard.doExport(ExportWizard.java:290)
 at com.android.ide.eclipse.adt.internal.wizards.export.ExportWizard.access$0(ExportWizard.java:229)
 at com.android.ide.eclipse.adt.internal.wizards.export.ExportWizard$1.run(ExportWizard.java:214)
 at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
Caused by: Command-line Error -1073741819
 at com.android.ide.eclipse.adt.internal.build.BuildHelper.executeAapt(BuildHelper.java:871)
 at com.android.ide.eclipse.adt.internal.build.BuildHelper.packageResources(BuildHelper.java:249)
 at com.android.ide.eclipse.adt.internal.project.ExportHelper.exportReleaseApk(ExportHelper.java:131)
 ... 4 more


2 comments:

ozi said...

I solved "Conversion to Dalvik format failed with error 1" with my own bruteforce idea :D Go to bin folder, inside classes folder delete every jar file that appears while building apk. Worked for me!

Anonymous said...

This really help me!!!!!
Thank you!!!!