Heri Sarwanto
Heri Sarwanto

Reputation: 75

A problem occurred evaluating root project 'audioplayers'. Failed to apply plugin [id 'kotlin-android'] in Flutter Project

When I create "flutter build apk" in my project I get an error like this:

*** What went wrong: A problem occurred evaluating root project 'audioplayers'.

Failed to apply plugin [id 'kotlin-android'] The current Gradle version 4.10.2 is not compatible with the Kotlin Gradle plugin. Please use Gradle 5.3 or newer, or the previous version of the Kotlin plugin. **

Error project

In this project, I'm using audioplayers: ^0.19.1 package. But when I run this project as usual "flutter run --verbose". successful.. in this case, I can't build apk.

Upvotes: 5

Views: 4628

Answers (1)

p.streef
p.streef

Reputation: 3815

As the error suggests, upgrade your gradle version.

Are you using the gradle wrapper? then find the file:

gradle/wrapper/gradle-wrapper.properties and update the version in the distro url to for instance distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip

edit: note that if you bump up by a few major version you might run into some deprecation issues. You could also go for version 5.3 which is the minimum your error suggests. if you are using the globally installed gradle version, upgrade that with whatever system you installed it.

Upvotes: 4

Related Questions