Multidex issue with Flutter

前端 未结 7 1156
青春惊慌失措
青春惊慌失措 2020-11-27 17:35

I\'m getting the following error compiling with gradle using Flutter in Android Studio:

Dex: Error converting bytecode to dex:
Cause: com.android.dex.DexExce         


        
7条回答
  •  情深已故
    2020-11-27 18:03

    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'
        }
    }
    

提交回复
热议问题