I'm pretty new to this but I've been struggling all night and figure I should probably ask for help!
When I try to run my flutter app on the emulator, I get the error in the title.
From lots and lots of google searching, it seems like it's a compatibility issue with different versions.
I've done my best to research which versions should be compatible but it's still not working. It seems that location 5.0.3 should work with gradle 8.0 which works with Kotlin 1.8.0.
In pubspec.yaml I have
location: ^5.0.3
In gradle-wrapper.properties I have
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-all.zip
In Android/app/build.gradle I have
compileSdkVersion 33
In Android/build.gradle I have
buildscript {
ext.kotlin_version = '1.8.0'
repositories {
google()
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
Can anyone see what I'm doing wrong?
Thanks in advance.
Also, I've done 'flutter clean' and 'flutter pub get' and 'flutter upgrade' a LOT, basically every time I tweak one of the version numbers. AFAIK that's not necessary but it doesn't take long so may as well be sure.
These are the settings that worked for me in the end if it helps anyone else! I never got "location" working but I went back to Geolocator (which I was actually trying to get to work first before trying location anyway but wasn't having any luck).
With these settings, I seem to be able to use the latest version of any dependency I try.
in build.gradle:
buildscript {ext.kotlin_version = '1.9.0'
and
dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
in app folder build.gradle: compileSdkVersion 33
and minSdkVersion 21 targetSdkVersion 29
under default config.
in gradle-wrapper.properties: distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip