在build.gradle文件中添加以下代码,使用最新的Gradle和Android插件,并删除旧的android-apt插件使用:
buildscript {
repositories {
// ...
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.0'
// ...
}
}
plugins {
// ...
}
android {
compileSdkVersion 30
defaultConfig {
// ...
}
buildTypes {
// ...
}
// ...
dependencies {
// ...
}
}
此外,在Gradle系统设置中确认已安装最新版本的Gradle。确保将旧的android-apt依赖项替换为annotationProcessor依赖项(如果使用了任何)。
dependencies {
implementation 'com.android.support:appcompat-v7:28.0.0'
// 使用 annotationProcessor 而不是 android-apt
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
// ...
}