Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Conversion to Dalvik format failed with error 1 in Android on export (adt 21)

Tags:

android

I know a form of this question is out there, but I can't find anything specifically that fits my scenario, so here it is.

My app compiles and runs perfectly when testing in the emulator, but when I try to export a signed apk I get the Conversion to Dalvik format failed with error 1. The Eclipse error log shows this stack trace:

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:751)
at com.android.ide.eclipse.adt.internal.project.ExportHelper.exportReleaseApk(ExportHelper.java:269)
at com.android.ide.eclipse.adt.internal.wizards.export.ExportWizard.doExport(ExportWizard.java:296)
at com.android.ide.eclipse.adt.internal.wizards.export.ExportWizard.access$0(ExportWizard.java:233)
at com.android.ide.eclipse.adt.internal.wizards.export.ExportWizard$1.run(ExportWizard.java:218)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)

I don't have the naming collisions that other people seem to have (at least it doesn't say so in the error), and I'm stumped as to why it runs in the emulator, but I can't export.

I'm not using ProGuard either, by the way.

like image 376
Spencer Avatar asked Apr 11 '13 04:04

Spencer


2 Answers

It looks like ADT 21 adds a folder to your bin called dexedLibs which ought to speed up deployment by putting jars and libraries in precompiled dex code. I had two versions of the support library there, so I deleted all the files in the folder and built again and it worked. If I try to build with any files in there the build fails though, so I have to delete them before each export. I'm using ActionBar Sherlock and that may be conflicting with the dexedLibs thing because it won't show up there unless the folder is initially empty.

Edit: I had been using ActionBarSherlock when this problem first came up, but have recently switched to ActionBarCompat. Since the switch, I no longer have to delete the dexedLibs folder when exporting. Looks like maybe ActionBarSherlock was to blame, but I can't be certain.

like image 125
Spencer Avatar answered Oct 13 '22 15:10

Spencer


Go to project and unselect Build Automatically. Then Clean the project and Build all. Worked for me to export signed application package

like image 42
anjaneya Avatar answered Oct 13 '22 17:10

anjaneya