react-native-push-notification: com.android.dex.DexIndexOverflowException: Cannot merge new index 67249 into a non-jumbo instruction

I’m on RN=0.39, and I’ve successfully added/linked many other RN libs into my project. This lib is failing on Android builds with the error message below, please advise.

:app:preDexDebug
:app:dexDebug
Unknown source file : UNEXPECTED TOP-LEVEL EXCEPTION:
Unknown source file : com.android.dex.DexIndexOverflowException: Cannot merge new index 67249 into a non-jumbo instruction!
Unknown source file : 	at com.android.dx.merge.InstructionTransformer.jumboCheck(InstructionTransformer.java:111)
Unknown source file : 	at com.android.dx.merge.InstructionTransformer.access$800(InstructionTransformer.java:26)
Unknown source file : 	at com.android.dx.merge.InstructionTransformer$StringVisitor.visit(InstructionTransformer.java:74)
Unknown source file : 	at com.android.dx.io.CodeReader.callVisit(CodeReader.java:114)
Unknown source file : 	at com.android.dx.io.CodeReader.visitAll(CodeReader.java:89)
Unknown source file : 	at com.android.dx.merge.InstructionTransformer.transform(InstructionTransformer.java:50)
Unknown source file : 	at com.android.dx.merge.DexMerger.transformCode(DexMerger.java:837)
Unknown source file : 	at com.android.dx.merge.DexMerger.transformMethods(DexMerger.java:811)
Unknown source file : 	at com.android.dx.merge.DexMerger.transformClassData(DexMerger.java:784)
Unknown source file : 	at com.android.dx.merge.DexMerger.transformClassDef(DexMerger.java:680)
Unknown source file : 	at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:534)
Unknown source file : 	at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:164)
Unknown source file : 	at com.android.dx.merge.DexMerger.merge(DexMerger.java:188)
Unknown source file : 	at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:504)
Unknown source file : 	at com.android.dx.command.dexer.Main.runMonoDex(Main.java:334)
Unknown source file : 	at com.android.dx.command.dexer.Main.run(Main.java:277)
Unknown source file : 	at com.android.dx.command.dexer.Main.main(Main.java:245)
Unknown source file : 	at com.android.dx.command.Main.main(Main.java:106)

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 7
  • Comments: 18 (1 by maintainers)

Most upvoted comments

@GeoffreyPlitt in your android/app/build.gradle add the dexOptions.

android {
   dexOptions {
        jumboMode true
    }
}

please look @ https://developer.android.com/studio/build/multidex.html

enable multidex in your build.gradle file.

android { defaultConfig { … minSdkVersion 15 targetSdkVersion 26 multiDexEnabled true } … }

I found out enabling multi-dex can solve the same problem as well, what is the right choice between these two approaches( jumboMode true )

android {
    ...
    defaultConfig {
        ...
        multiDexEnabled true
    }
}