0
votes

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

1
which plugin versions are u using? - Peter Haddad
@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. - Raine Dale Holgado

1 Answers

1
votes

Update the minSdkVersion:

minSdkVersion 15 

to

minSdkVersion 23