升級Gradle到最新版本後,編譯提示以下錯誤.
ERROR: The Android Gradle plugin supports only Kotlin Gradle plugin version 1.3.10 and higher.
The following dependencies do not satisfy the required version:
root project 'MyApplication' -> org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.61
報錯原因是Gradle對kotlin的插件版本有要求。
解決方法
打開根目錄的build.gradle,修改kotlin插件的版本。
buildscript {
//修改kotlin插件的版本號
ext.kotlin_version = '1.3.31'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}