Flutter google maps android build failed

Issue

I tried to add google maps to my flutter project

dependencies:

  geolocator: ^2.1.0
  google_maps_flutter:
<manifest ...
  <application ...
    <meta-data android:name="com.google.android.geo.API_KEY"
               android:value="my key was here"/>

The problem is that after adding this dependence, every running – build failed with this message:

FAILURE: Build failed with an exception.

* What went wrong:
The Android Gradle plugin supports only Kotlin Gradle plugin version 1.3.10 and higher.
The following dependencies do not satisfy the required version:
project ':google_api_availability' -> org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.71

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 2s
Finished with error: Gradle task assembleDebug failed with exit code 1

of course, I tried to change the gradle version to another one, as it advised in other posts, but it didn’t help.
I really don’t know what the problem is, because without maps the project compiles, I checked.

Solution

You have to upgrade the geolocator package which depends on google_api_availability by running the command flutter pub upgrade

Answered By – F Perroch

Answer Checked By – Mildred Charles (FlutterFixes Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *