Multidex Issue with Flutter

Multidex issue with Flutter

Your two packages seem to disagree on their transitive dependencies. One wants 11.6.+, the other wants 11.+ of some play-services dependencies. Since both 11.6.2 and 11.8.0 are out there, this is going to end up with a conflict.

If you run ./gradlew androidDependencies in your android/ folder, you get a listing of the result of dependency resolution, containing, among others, the following:

+--- :flutter_google_place_picker (variant: release)
+--- com.google.android.gms:play-services-location:11.8.0@aar
+--- com.google.android.gms:play-services-places:11.6.2@aar
+--- com.google.android.gms:play-services-maps:11.6.2@aar
+--- com.google.android.gms:play-services-base:11.8.0@aar
+--- com.google.android.gms:play-services-tasks:11.8.0@aar
+--- com.google.android.gms:play-services-basement:11.8.0@aar

These 11.6.2 and 11.8.0 packages are not going to work together. To resolve this, you need to patch your dependencies to be consistent with each other, or add a dependency override to the top level of your android/app/build.gradle file and hope for the best:

configurations.all {
resolutionStrategy {
force 'com.google.android.gms:play-services-places:11.8.0'
force 'com.google.android.gms:play-services-location:11.8.0'
}
}

App requires Multidex support in flutter?

Have you tried "flutter clean" and then rebuild? You can let the Flutter CLI tool do it for you with "flutter build --multidex".

Flutter multidex problem With FirebaseAuth , Firestore and Google Sign in

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

         defaultConfig {
...
multiDexEnabled true
}

Don't forget:

flutter clean

Adding multidex support to Flutter

Finally, I fixed it with removing the CloudFirestore implementation. Seems there is a version bug at the time.

Flutter enable multiDex for SDK less than 21

Actually I need to create my own java class say MyApplication.java like this.

public class MyApplication extends FlutterApplication {
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
}

After this in AndroidManifest.xml file, change

<application
android:name="io.flutter.app.FlutterApplication" .../>

to

<application
android:name=".MyApplication" .../>


Related Topics



Leave a reply



Submit