47

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?

Peter O.
  • 32,158
  • 14
  • 82
  • 96
Ripul
  • 1,271
  • 4
  • 15
  • 18
  • Try reopening your eclipse. I was able to solve that error using that. – MysticMagicϡ Nov 19 '12 at 06:14
  • I tried that so many times, but just stuck here! – Ripul Nov 19 '12 at 23:13
  • @Ripul were you able to get opensaml and android poc working – Aniruddha K.M Jun 16 '16 at 12:48
  • @war_Hero, not really, it had far too much dependencies which I could not bundle in one single Android app. I wrote down a curtailed version of SAML, based on SICS lightweight SAML library (https://www.sics.se/~ludwig/assertionServer/SAMLlib.pdf). Hope it helps. – Ripul Jun 16 '16 at 13:13
  • @Ripul am trying to implement saml in android webview so far nothing has come up yet, asked cause you had tagged both android and saml thanks anyways – Aniruddha K.M Jun 16 '16 at 13:15

7 Answers7

54

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.

Malachi
  • 33,142
  • 18
  • 63
  • 96
  • Thanks for your answer. I tried that one. But I get this:
    Installation error: INSTALL_FAILED_DEXOPT Please check logcat output for more details. Launch canceled! Then I checked the logcat. And in the logcat, the output is: W/installd(40): DexInv: --- END '/data/app/*.apk' --- status=0xff00, process failed E/installd(40): dexopt failed on '/data/dalvik-cache/data@app@*.apk@classes.dex' res = 65280 W/PackageManager(149): Package couldn't be installed in /data/app/*.apk.
    Any ideas?
    – Ripul Nov 19 '12 at 23:27
  • 2
    Tried doing a clean rebuild? – Malachi Nov 20 '12 at 09:34
  • Sure I did. The trouble is the logcat is not producing enough output to understand what is happening! – Ripul Nov 20 '12 at 13:52
  • 1
    Worked for me, did need to clean and rebuild and then run into a problem due to [INSTALL_FAILED_UID_CHANGED](http://stackoverflow.com/questions/12338242/eclipse-installation-error-install-failed-uid-changed) which a reboot of the phone seem to solve. – PJL Nov 21 '12 at 16:34
  • I cleaned and rebuilt the project, rebooted the phone, restarted the Editor. Still no solution. Just stuck! – Ripul Nov 23 '12 at 23:02
  • I also got stuck to the point where I had to delete my sources and get fresh ones from source control which fixed the problem. I do think that this problem is waiting to bite me again and my errors were flipping between `INSTALL_FAILED_UID_CHANGED` and `INSTALL_FAILED_DEXOPT`. – PJL Nov 25 '12 at 14:41
  • i put this dex.force.jumbo=true, but i couldn't solve my problem – Hiren Patel Apr 15 '13 at 05:12
  • @HirenPatel what version of ADT are you running? – Malachi Apr 15 '13 at 07:25
  • hi, i tried this but i can not get proper result, please tell another solution for this problem, thanks in advance. – Hiren Patel Apr 22 '13 at 05:15
  • I added `dex.force.jumbo=true` to my `project.properties` and i have version 21 of ADT and i still get the `Unable to execute dex: Cannot merge new index 66719 into a non-jumbo instruction!` error. – string.Empty May 03 '13 at 12:51
  • @NicolasTyler Tried doing a clean then build? You may have to close and open your project... – Malachi May 03 '13 at 13:30
  • i tried increasing eclipses heap size and adding `dex.force.jumbo=true` but still get this error: http://pastebin.com/UMzK2Xvg – string.Empty May 06 '13 at 05:51
  • @Ripul i don't know whether you have solved this or not , may be its too late but if you haven't solved this make sure that line "dex.force.jumbo=true" is first line in your project.properties file. – Rohan Jan 29 '15 at 06:22
14

The same problem...just put

dex.force.jumbo=true

in the first line of project.properties

Rino
  • 733
  • 8
  • 19
  • Did not make any difference for me to put the line to the beginning or end. Still not working. – stdout Feb 04 '16 at 11:16
  • Using Eclipse or Android Studio? This link can help you http://developer.android.com/tools/building/multidex.html – Rino Feb 05 '16 at 13:43
13

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.

gary
  • 1,569
  • 3
  • 20
  • 30
6

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).

Sebastiano
  • 12,289
  • 6
  • 47
  • 80
  • No such section **Android DX** in settings. And no such option **Force jumbo mode** in Android Studio (based on IntelliJ IDEA). – ViliusK May 18 '15 at 09:40
  • 1
    Because IntelliJ differs from Android Studio in many aspects, this being one of them. Since Studio uses Gradle by default, you need to specify `dexOptions { jumboMode = true }` in your `build.gradle` file. – Sebastiano May 18 '15 at 09:42
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."

mobileasumma
  • 51
  • 1
  • 2
2

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.

mariaines
  • 497
  • 1
  • 5
  • 17
0

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

Fahmi Sidik
  • 189
  • 5
  • 13