Reputation: 41
This is the entire error message:
FAILURE: Build failed with an exception.
What went wrong: The Android Gradle plugin supports only Kotlin Gradle plugin version 1.5.20 and higher. The following dependencies do not satisfy the required version: project ':wakelock' -> org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.50
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.
BUILD FAILED in 698ms Running Gradle task 'assembleRelease'... 1,181ms Gradle task assembleRelease failed with exit code 1
This error happens when I try to do either of these commands: Flutter build apk OR Flutter build appbundle.
I have tried to change the kotlin verions in the android build.gradle files, but I still have this issue. When I tried to change the gradle version, I get another issue which is:
FAILURE: Build failed with an exception.
Could not resolve all files for configuration ':classpath'. Could not find com.android.tools.build:gradle:7.5.0. Searched in the following locations: - https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/7.5.0/gradle-7.5.0.pom - https://repo.maven.apache.org/maven2/com/android/tools/build/gradle/7.5.0/gradle-7.5.0.pom Required by: project : Could not find com.android.tools.build:gradle:7.5.0. Searched in the following locations: - https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/7.5.0/gradle-7.5.0.pom - https://repo.maven.apache.org/maven2/com/android/tools/build/gradle/7.5.0/gradle-7.5.0.pom Required by: project :
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.
Any Help?
Upvotes: 4
Views: 2395
Reputation: 1432
I faced exactly this issue yesterday after importing flutter project to Android Studio after creating a new project with wakelock dependency by "flutter create" command.
Then, I made flutter clean, left only necessary files (created by me) in the project folder and made "flutter create ." inside the project directory.
Then I opened the project from Android Studio by File/Open and not by New/Import as I did before, and the problem is fixed now.
I remember that Project/Import asked many stupid questions including Kotlin config, so may be this is the cause of the problem.
Upvotes: 0