0

Error when adding firebase package

Execution failed for task ':app:mergeDexDebug'. A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: The number of method references in a .dex file cannot exceed 64K. Learn how to resolve this issue at https://developer.android.com/tools/building/multidex.html

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel beta, 1.21.0-9.2.pre, on Microsoft Windows [Version 10.0.18362.1082], locale en-US)
 
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[√] Chrome - develop for the web
[√] Android Studio (version 4.0)
[√] VS Code (version 1.49.0)
[√] Connected device (3 available)

How to fix it

android/app/build.gradle add multiDexEnabled true

android {
    defaultConfig {
        ...
        minSdkVersion 15 
        targetSdkVersion 28
        multiDexEnabled true
    }
    ...
}

dependencies {
  implementation 'com.android.support:multidex:1.0.3'
}

Reference: https://developer.android.com/studio/build/multidex

2
  • which plugin versions are u using? Commented Sep 16, 2020 at 10:47
  • @PeterHaddad, i updated the post with my flutter doctor. Just today the problem occurs, Some people posted today on our fb flutter community that they encounter that problem yesterday. So I decided to create fresh project with firebase packages and that happens. So i feel like sharing this if they might encounter the same. Commented Sep 16, 2020 at 10:54

1 Answer 1

1

Update the minSdkVersion:

minSdkVersion 15 

to

minSdkVersion 23 
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.