简体   繁体   中英

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. **

错误项目

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM