I am trying to place advertising in my flutter app, this is proving to be almost more complicated for me than creating the app itself (I am a newbie dev starting with flutter).
I get an error when I try to launch my app that says the following: [!] Your project requires a newer version of the Kotlin Gradle plugin. Find the latest version on https://kotlinlang.org/docs/gradle.html#plugin-and-versions, then update C:\Users\User\Desktop\Dev\adtest\android\build.gradle: ext.kotlin_version = '' Exception: Gradle task assembleDebug failed with exit code 1
The problem seems simple, I have to update the field suggested by the console. My surprise is that the field ext.kotlin_version = " ", does not exist in my build.grade file on android/build.gradle. Neither does the buildscript { } apatagate exist that should contain it. I have android Studio installed, Flutter updated, I work with visual studio code, everything is apparently correct, except for this.
Thanks for your help.
It's an old question but still valid. I spent almost full day in troubleshooting and using various combinations. Ultimately I made this change in "myapp_root_folder\android\settings.gradle"
file
plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "7.3.0" apply false
//id "org.jetbrains.kotlin.android" version "1.7.10" apply false **//Replaced this**
id "org.jetbrains.kotlin.android" version "1.9.22" apply false **// With This**
}
Hope it helps someone.
Add ext.kotlin_version
and kotlin dependency in <app>/android/build.gradle
file.
buildscript {
ext.kotlin_version = '1.5.0' //use latest
...
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
...
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With