Android: Jumbo Mode vs Multidex

I’m not totally sure what the difference is between setting dex option “jumbomode” to true vs adding multidex support.

Setting jumbo mode to true or multidex to true seems to fix the problem below

  • Using try/catch for preventing app from crashes
  • Elevation not working for ImageView
  • Android — Add new tab when button click like Google Chrome new button?
  • Illegal modifier error for static class
  • How to configure proguard to ONLY remove android logging calls
  • How to move buttons text when state is pressed
  • AGPBI: {"kind":"SIMPLE","text":"UNEXPECTED TOP-LEVEL EXCEPTION:","position":{},"original":"UNEXPECTED TOP-LEVEL EXCEPTION:"}
    AGPBI: {"kind":"SIMPLE","text":"com.android.dex.DexIndexOverflowException: Cannot merge new index 65772 into a non-jumbo instruction!","position":{},"original":"com.android.dex.DexIndexOverflowException: Cannot merge new index 65772 into a non-jumbo instruction!"}
    AGPBI: {"kind":"SIMPLE","text":"\tat com.android.dx.merge.InstructionTransformer.jumboCheck(InstructionTransformer.java:109)","position":{},"original":"\tat com.android.dx.merge.InstructionTransformer.jumboCheck(InstructionTransformer.java:109)"}
    AGPBI: {"kind":"SIMPLE","text":"\tat com.android.dx.merge.InstructionTransformer.access$800(InstructionTransformer.java:26)","position":{},"original":"\tat com.android.dx.merge.InstructionTransformer.access$800(InstructionTransformer.java:26)"}
    AGPBI: {"kind":"SIMPLE","text":"\tat com.android.dx.merge.InstructionTransformer$StringVisitor.visit(InstructionTransformer.java:72)","position":{},"original":"\tat com.android.dx.merge.InstructionTransformer$StringVisitor.visit(InstructionTransformer.java:72)"}
    AGPBI: {"kind":"SIMPLE","text":"\tat com.android.dx.io.CodeReader.callVisit(CodeReader.java:114)","position":{},"original":"\tat com.android.dx.io.CodeReader.callVisit(CodeReader.java:114)"}
    AGPBI: {"kind":"SIMPLE","text":"\tat com.android.dx.io.CodeReader.visitAll(CodeReader.java:89)","position":{},"original":"\tat com.android.dx.io.CodeReader.visitAll(CodeReader.java:89)"}
    AGPBI: {"kind":"SIMPLE","text":"\tat com.android.dx.merge.InstructionTransformer.transform(InstructionTransformer.java:49)","position":{},"original":"\tat com.android.dx.merge.InstructionTransformer.transform(InstructionTransformer.java:49)"}
    ...
    

  • How to read the current frame buffer in android?
  • GreenDAO schema update and data migration?
  • How to properly add custom view to the toolbar?
  • “Unparseable date: 1302828677828” trying to deserialize with Gson a millisecond-format date received from server
  • How to use SoundCloud API in Java (Android App)
  • Set LayoutDirection (RTL) for api lower than 17
  • 2 Solutions collect form web for “Android: Jumbo Mode vs Multidex”

    Jumbo Mode, when reading
    https://source.android.com/devices/tech/dalvik/dalvik-bytecode.html, the const-string/jumbo is the jumbo mode for string. It is about the opcode such that “op vAA, string@BBBBBBBB” versus “op vAA, string@BBBB”, 32 bits versus 16 bit.

    Multi Dex is to allow to load classes from more than one dex file. The primary classes.dex must contain the classes necessary for calling this class methods. Secondary dex files found in the application apk will be added to the classloader after first call to MultiDex.install(Context)
    see https://developer.android.com/reference/android/support/multidex/MultiDex.html

    take a look into this (search for jumbo):

    https://developers.soundcloud.com/blog/congratulations-you-have-a-lot-of-code-remedying-androids-method-limit-part-1

    in short:
    – similar to Android Method count limit (64K) – there’s a limit on string count (64K)
    – to overcome this limit – jumbo mode enables referencing more than 2^16 strings by using special opCode that enables encoding up to 2^32 strings.

    in practice:
    – from my experience both (MultiDex & JumboMode) have major impact on apk installation time (much slower).

    hope this helps:)

    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.