0

Currently I'm doing a Flutter application witch uses:

  geolocator: ^5.1.4+1
  google_maps_flutter: ^0.5.21+7

When I declare both dependencies in "pubspec.yaml" it get a conflict

"FAILURE: Build failed with an exception.

  • What went wrong:

    Execution failed for task ':app:preDebugBuild'.

    Android dependency 'com.google.android.gms:play-services-tasks' has different version for the compile (16.0.1) and runtime (17.0.0) classpath. You should manually set the same version via DependencyResolution"

  • I've tryied also by editing gradle.properties with:

   android.useAndroidX=true
   android.enableJetifier=true

And in "app/build.gradle" added the dependencies as classpath and/or api as needed:

com.google.android.gms:play-services-tasks

Is anyone facing same issue? In case you solved it, what have you done to solve it?

Kalana
  • 5,631
  • 7
  • 30
  • 51

1 Answers1

0

I had exactly the same problem, though using google_maps_flutter0.5.21+8. I added for every error message the following line to android/app/build.gradle under dependencies. Look then like the following:

dependencies {
    ...

    implementation 'androidx.cursoradapter:cursoradapter:1.0.0'
    implementation 'androidx.drawerlayout:drawerlayout:1.0.0'
    implementation 'androidx.documentfile:documentfile:1.0.0'
    implementation 'androidx.viewpager:viewpager:1.0.0'
    implementation 'androidx.arch.core:core-runtime:2.0.0'
    implementation 'androidx.legacy:legacy-support-core-utils:1.0.0'
    implementation 'androidx.fragment:fragment:1.0.0'
    implementation 'androidx.core:core:1.1.0'
    implementation 'com.google.android.gms:play-services-basement:17.0.0'
    implementation 'com.google.android.gms:play-services-base:17.0.0'
}

Hope that helps. If there's a better way please tell. No flutter expert so far.

Timisorean
  • 1,388
  • 7
  • 20
  • 30