My Reminder: How to fix "conversion to Dalvik format failed with error code 1"
Join the DZone community and get the full member experience.Join For Free
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.
the 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
- i start with doing a clean build of the project with “project – clean”. i include the project and any projects it depends on.
- 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.
Published at DZone with permission of Bill Lahti. See the original article here.
Opinions expressed by DZone contributors are their own.