Error while merging dex archives React Native Error Fix

I came across this react native error when I tried to run my react native project with react-native run-android command after adding a third party library which made native changes.

Here’s the error which caused the failure of the app build:
java.lang.RuntimeException: java.lang.RuntimeException: Error while merg ing dex archives: The number of method references in a .dex file cannot exceed 64K.

It’s a dex related issue and I found a solution for this from stackoverflow.

What I did is, opened MyProject/android/app/build.gradle file and added multiDexEnabled true inside defaultConfig tag as given below:

defaultConfig {
       multiDexEnabled true

Re runnung the project with react-native run-android made the errors gone somewhere else in the air!

Similar Posts

Leave a Reply