Flutter | The Android Gradle plugin supports only Kotlin Gradle plugin version 1.3.0 and higher
You can find which package depends on google_api_availability
by running flutter packages pub deps
on the root of the project - this will list all the direct and transitive dependencies of your project in a tree view.
I couldn't find a way to display the plugin dependencies of a package - I guess you'll only find out once you try to build it.
The problem is you are using version 3.3.1
of the Android Gradle plugin, which enforces Kotlin 1.3.0
or above. At the same time, the geolocator
package depends on google_api_availability
, which seems to be using Kotlin 1.2.71
. At the moment there is no version of google_api_availability
that uses Kotlin 1.3.0
or above, so you only have 1 solution - downgrade the Android Gradle plugin to version 3.2.1
.
The Android Gradle plugin supports only Kotlin Gradle plugin version 1.3.0 and higher.
The following dependencies do not satisfy the required version:
project ':google_api_availability' -> org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.71
The solution we used was to include the package and all their dependency directly in the flutter build environment. !! This might not be ideal in the long run, but will help you while this AndroidX migration is happening and messing with your builds.
In the pubspec.yaml we included specific versions like so
geolocator: 3.0.0 # AndroidX - Breaking!
google_api_availability: 1.0.6 # Geolocator Dependency.
meta: 1.1.6 # Geolocator Dependency.
permission_handler: 2.2.0 # Geolocator & Meta Dependency.
The breakage for us happend between the google_api_availability v1.0.6 and v2.0.0
You can find which package depends on google_api_availability by doing as Ovidiu sayes or by opening https://pub.dartlang.org/ and type "dependency:google_api_availability
" in the search bar. Also on each package page you can see the dependency and who depends on them.
In android folder you shall see file named as build.gradle
You would see a piece of code
buildscript {
ext.kotlin_version = 'x.x.xx'
repositories {
google()
jcenter()
}
edit the version of property ext.kotlin_version by replacing x.x.xx with 1.3.10
This should help you in resolve the error