Home » Android » java – Android: Conversion to Dalvik format failed: Unable to execute dex: null

java – Android: Conversion to Dalvik format failed: Unable to execute dex: null

Posted by: admin April 23, 2020 Leave a comment

Questions:

I’m trying to use the SmugFig SmugMug API on Android. It was designed for J2SE I would imagine, so I’m not sure it will even work on Android, but I figured it was worth trying as opposed to trying to create my own API.

When I load the project though, I get the following error:

Conversion to Dalvik format failed: Unable to execute dex: null

It doesn’t say what package it fails on, just “Android Packaging Problem”, but it did not do this before I added SmugFig and it’s dependency JARS to the build path.

Where should I look? Or does this mainly me that it just won’t work with those libraries?

How to&Answers:

I found a blog entry that says increase the memory allocated in eclipse.ini to this:
-Xms128m
-Xmx512m
or something higher, but this didn’t do it for me.

However, I found another post that suggested doing Project > Clean and that fixed it for me.
I think it happens when you shut down Eclipse w/o shutting the emulator down first. Pretty lame bug. Spent a few hours digging for the solution this morning…grrrrrrr 🙁

Answer:

Go to Project » Properties » Java Build Path » Libraries and remove all except the “Android X.Y” (in my case Android 1.5). click OK. Go to Project » Clean » Clean projects selected below » select your project and click OK. That should work.

It is also possible that you have a JAR file located somewhere in your project folders (I had copied the Admob JAR file into my src folder) and THEN added it as a Java Path Library. It does not show up under the Package Explorer, so you don’t notice it, but it does get counted twice, causing the dreaded Dalvik error 1.

Another possible reason could be package name conflicts. Suppose you have a package com.abc.xyz and a class named A.java inside this package, and another library project (which is added to the dependency of this project) which contains the same com.abc.xyz.A.java, then you will be getting the exact same error. This means, you have multiple references to the same file A.java and can’t properly build it.

Answer:

After the Eclipse DDMS update 8.0.0 came with the release of Android 2.3 this error suddenly appeared.

None of the above suggestions helped, but it turned out that the root of the problem was a referenced project (a few classes shared between the server and client sides).

Once I removed the project reference and built and included a jar of the once referenced project the problem ceased to exist.

Seems like something went rogue in DDMS 8.0.0 with referenced projects.

Answer:

What worked for me was removing the android.jar reference in

Configure Build Path -> Java Build Path -> Libraries

Leave the Android 3.0 library reference.

Answer:

its simply because of the Heap size occupied by some JAR files…which can be removed manually…

else the best option is to modify the Eclipse.ini file in the eclipse folder…..

add -Xmx1024m to the file to make the memory size to 1 GB …it woul work for sure…..

Answer:

Steps that help me to remove this error

  1. remove user libraries(external libraries).
  2. clean the project
  3. again add the external library
  4. build the project
  5. run the project.

Hope this will be helpful to you.
Thanks.

Answer:

http://groups.google.com/group/android-developers/browse_thread/thread/3911749addce534d

They are working on pushing a fix now for 2.3

Edit: This has been fixed for 2.3 , go get the update via eclipse.

Answer:

-startup
plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.100.v20110502
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
512m
--launcher.defaultAction
openFile
-XX:MaxPermSize=512m
-vmargs
-Xms512m
-Xmx1024m

works for me https://groups.google.com/forum/?fromgroups=#!topic/phonegap/yWePvssyiLE

Answer:

Ensure you don’t reference the same project within a jar and eclipse. For instance, you have a project called myproject in eclipse. Your android project references both myproject project and the jar generated from it. This will give an error when you try to dex as it tries to dex against the generated classes from myproject and from the myproject.jar

Answer:

Only this solve my problem .Project > Clean

Answer:

Here they suggest that these error is caused by huge .java files.

I had the same problem and incrementing the memory allocated works for me.

Answer:

I helper to remove /home/user/.android folder.
OS: Debian Wheezy 32bit

Answer:

Absolutely none of the previously mentioned “fixes” have worked for me, which comes as no surprise because they aren’t even addressing the problem to begin with.

The bug itself stems from a conflict with Proguard. Here is the bug report: http://code.google.com/p/android/issues/detail?id=18359 And to fix it, you simply need to manually update Proguard: http://sourceforge.net/projects/proguard/files/latest/download?source=files

Answer:

For projects which uses New Relic

Update New Relic via “Update New Relic” under Project r’click -> Update New Relic. This worked for me.