在将 Android Studio 升级到北极狐版本并将 Gradle 升级到 7.0.0 后,我收到 Gradle 错误: 你能帮我解决这个问题吗? 我正在使用:
ViewModel 和 LiveData
科特林
协程
刀柄
房间
工作经理
Opencsv
Exception is:
org.gradle.api.GradleScriptException: A problem occurred evaluating project ':app'.
at ... Caused by: groovy.lang.MissingMethodException: No signature of method: build_81ndl2arupw8e1yms1mvvhjf2.android() is applicable for argument types: (build_81ndl2arupw8e1yms1mvvhjf2$_run_closure1) values: [build_81ndl2arupw8e1yms1mvvhjf2$_run_closure1@357f1275]
at build_81ndl2arupw8e1yms1mvvhjf2.run(F:\Projects\InfoContest\app\build.gradle:8)
at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:91)
... 140 more
android 在 build.gradle 中:
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "mohalim.contest.alarm"
minSdkVersion 21
targetSdkVersion 30
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildFeatures {
dataBinding true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
androidResources {
noCompress 'csv'
}
}
答案 0 :(得分:0)
升级后我也遇到了同样的情况 Gradle 和 AGP 版本 7. 就我而言,删除块
javaCompileOptions {
annotationProcessorOptions {
includeCompileClasspath false
}
}
从android块内部,解决了问题。
答案 1 :(得分:0)
尝试删除此块
androidResources {
noCompress 'csv'
}
或替换为
aaptOptions {
noCompress 'csv'
}