title: Dexopt failed on a very big APK (Out-of-order method_idx) when dex.force.jumbo=true
body: <p>I have a very big Android project with a multiple, big, 3rd party jars (as Android Libraries).<br>
  I believe I've hit a Dex's max number of method limitation (compiling via eclipse):  </p>
  
  <blockquote>
    <p>[2012-11-18 02:28:45 - Find In Files] Dx processing classes.dex...<br>
    [2012-11-18 02:28:48 - Dex Loader] Unable to execute dex: Cannot merge new index 66774 into a non-jumbo instruction!<br>
    [2012-11-18 02:28:48 - Find In Files] Conversion to Dalvik format failed: Unable to execute dex: Cannot merge new index 66774 into a non-jumbo instruction!  </p>
  </blockquote>
  
  <p>Taking advantage of SDK tools 21 (platform tools 16), I therefore, edited my main project project.properties to set <code>dex.force.jumbo=true</code>.<br>
  The flag allowed to me generate the APK. But I couldn't install it properly (on physical and emulator alike). There seems to be a dex optimizer failure:</p>
  
  <blockquote>
    <p>11-18 20:11:05.338: I/PackageManager(103): Running dexopt on: com.mypackage.myapp<br>
    11-18 20:11:08.577: E/dalvikvm(868): Out-of-order method_idx: 0x2ae0 then 0x1<br>
    11-18 20:11:08.577: E/dalvikvm(868): Trouble with item 1544 @ offset 0xf7ae24<br>
    11-18 20:11:08.577: E/dalvikvm(868): Swap of section type 2006 failed<br>
    11-18 20:11:08.577: E/dalvikvm(868): ERROR: Byte swap + verify failed<br>
    11-18 20:11:08.597: E/dalvikvm(868): Optimization failed<br>
    11-18 20:11:08.597: W/installd(39): DexInv: --- END '/data/app/com.mypackage.myapp-1.apk' --- status=0xff00, process failed<br>
    11-18 20:11:08.597: E/installd(39): dexopt failed on '/data/dalvik-cache/data@app@com.mypackage.myapp-1.apk@classes.dex' res = 65280<br>
    11-18 20:11:08.697: W/PackageManager(103): Package couldn't be installed in /data/app/com.mypackage.myapp-1.apk<br>
    11-18 20:11:09.018: D/dalvikvm(103): GC_EXPLICIT freed 1698K, 13% free 17034K/19463K, paused 7ms+135ms<br>
    11-18 20:11:09.068: D/AndroidRuntime(780): Shutting down VM</p>
  </blockquote>
  
  <p>Am I trying to use the <code>dex.force.jumbo</code> flag for a purpose it was not intended for, or is this error unpredictable?<br>
  If so, is there a better strategy to generate a project that includes a very big number of classes/methods?</p>