Flutter multidex problem With FirebaseAuth , Firestore and Google Sign in

4,574

Solution 1

In your app/build.gradle file inside your android folder , add this attribute multiDexEnabled.

         defaultConfig {
                ...
                multiDexEnabled true
            }

Don't forget:

flutter clean

Solution 2

Although having a multiDexEnabled true can solve the problem it will result in a minSdkVersion 21 for your application because it will crash on all older devices than lollipop witch means losing millions of potential customers who still own this phones , right 🤔😥??

there is a better solution

just open your App level build.gradle and add these lines in place :

buildTypes {
        release {
             minifyEnabled true
        }
        debug{
            minifyEnabled true
        }
        
    }

Solution 3

I did for this same error to make it work

multiDexEnabled true

dependencies {
implementation "androidx.multidex:multidex:2.0.1"
}

documentation

Share:
4,574
Asfaque Ahmed
Author by

Asfaque Ahmed

Updated on December 06, 2022

Comments

  • Asfaque Ahmed
    Asfaque Ahmed over 1 year

    Flutter application is working fine if i use only firestore. But as now i want to add Firebase Auth it is Causing problem And showing Dex error log

    How can i use both firestore and Firebase Auth.