expo: ExpoKit Android: "Too many classes in --main-dex-list, main dex capacity exceeded"

I want to integrate my own push notification, so I detach my exp project. After detached, Android project build failed.

Error:Execution failed for task ':app:transformClassesWithDexForDev19Debug'. com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Too many classes in --main-dex-list, main dex capacity exceeded

  • Simulator (Android5.1 API 22) build failed
  • Simulator (Android6.0 API 23) build success
  • My sdkVersion is 24.0.0

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 13
  • Comments: 23 (6 by maintainers)

Most upvoted comments

Try add this, works for me while ./gradlew assembleProdRelease

android {

    dexOptions {
        keepRuntimeAnnotatedClasses false
    }

}

Refference: https://stackoverflow.com/questions/32721083/too-many-classes-in-main-dex-list-main-dex-capacity-exceeded

@Rumidom it’s the android/app/build.gradle file

change the buildToolsVersion to “27.0.2” it’s sloved

@johhansantana Fastest answer would be just avoid dev19 from flavor

image

@johhansantana @linzebin @nicoara Hi~ I’ve had few days to solve this problem in expo detached app for android. Please refer to expo forum in link here.

I’ve had someone fixed same problem following what I’ve written here. Hope it helps you people~

Hey there, sorry about the annoyance. For now I think the best thing to do is to use a prod target, or keep targeting a newer version of Android.

Leaving this issue open so we can come up with a better answer.