My Reminder: How to fix “conversion to Dalvik format failed with error code 1”

Every month or so, while exporting an Android application to get an apk file, I see the mysterious message: “Conversion to Dalvik format failed with error code 1”. Information on what to do is easy to come by. I search Google on that phrase and get to another great StackOverflow page with an explanation.

export-app-error-code-1The problem for me is that particular question /answer post is fairly long and points out that there  are several different things you should try. Since I keep forgetting which of those work for me, I am posting ny standard steps for myself here.

I work on a Macbook, run Eclipse, and I usually do very well at keeping my Android environment up-to-date. Also, when I build I have Proguard set to run, which means I will see some unusual messages from time to time. Those tend to throw me off and forget what I should be doing.

My Standard Fixes

  1. I start with doing a clean build of the project with “Project – Clean”. I include the project and any projects it depends on.
  2. Then I check to see which Proguard I have installed. A new Proguard is required. Right now that is 4.11.

Step 1 used to be all I needed to do. I’d do the “clean” build and then try to export again, and it would work. This last week, however, that did not help. The export would fail and the Console messages would indicate that Proguard was having trouble. There are, of course, lots of things that Proguard can report on, but these messages said that none of the classes of the app itself  could be found. That did not make sense to me since I had built apk files for the very same app not long before. So that’s when the closer reading of the StackOverflow message paid off.  Someone noted that a newer Proguard fixed the problem for them.

Android tool set for Eclipse has an old version of Proguard. One more thing to watch out for is that the Android tools in Eclipse have an old version of Proguard. Any time you update that part of your Eclipse installation, it is going to overwrite the new Proguard you installed with one that might not work. So that’s why I have two steps. Fixing the problem with Step 2 is something I have to keep doing until the newer Proguard is in the Android tools update. The Proguard folder is inside folder “android\sdk\tools”.

So good advice, as always, from StackOverflow provides a solution. And for me, a good reminder is what I need so here it is in an easy place for me to find it.


About Bill Lahti

Bill Lahti is a software engineer building mobile applications and knowledge management solutions. Two of his interests are writing for this blog and building Android apps, with strategy games being an area of particular interest.
This entry was posted in Android and tagged , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s