Android Error in Eclipse: “Unable to execute dex:

2019-01-10 22:45发布

问题:

I am trying an Android project using OpenSAML using Eclipse. I have added all the required jar files in the build path. Now, when I run the program as an Android Application the following error shows up:

[2012-11-18 11:52:59 - Dex Loader] Unable to execute dex: Cannot merge new index 67075 into a non-jumbo instruction!
[2012-11-18 11:52:59 - MyTestProgram] Conversion to Dalvik format failed: Unable to execute dex: Cannot merge new index 67075 into a non-jumbo instruction!

I googled a bit, but nothing came up. What could this error mean?

回答1:

One solution that I found that got it working for me was to add dex.force.jumbo=true to my project.properties.

This was pointed out at: https://groups.google.com/forum/?fromgroups=#!topic/adt-dev/tuLXN9GkVas

This is assuming you are running ADT 21 as this feature wasn't available in previous versions.



回答2:

The same problem...just put

dex.force.jumbo=true

in the first line of project.properties



回答3:

If using gradle build, just add the dexOptions into build.gradle to enable jumbo mode:

android {
    dexOptions {
        jumboMode = true
    }
}

Remember to run "gradle clean" before your new building.



回答4:

I had the same problem, but my IDE was IntelliJ IDEA 13. In that version, the dex.force.jumbo instruction in the project.properties file is ignored.

To enable it, just go to Settings | Compiler | Android DX and select the Force jumbo mode option.

Hope it helps (this is the only SO-related question I have been able to find).



回答5:

Just adding jumboMode=true didn't work for my gradle build. However this worked (quoted from Xavier in the adt-dev group as a reply to a bug filed in this area):

"Try to delete all the build folders manually and build again, making sure the dexOptions.jumboMode is set to true in the project?

There's an issue where the root project's build is not deleted in the clean task and this contains some information about the pre-dexed libraries."



回答6:

Adding some explanation:

This happens when Eclipse tries to incrementally build, when a change increases the number of string constants in the application. The original dex had non-jumbo instructions, and the new dex that's being merged into it has jumbo instructions. Doing a clean will show that it works when you build from scratch.

As long as the number of strings in your application is monotonically increasing, incremental builds will work going forward.



回答7:

I had the same problem, but in my case the "dex.force.jumbo=true" command doesn't solve the problem. I try to update JDK and JRE , and that solve the problem.

Hope this answer help