Android Gradle build error: Caused by: groovy.lang.MissingMe



当Android studio gradle试图构建我的应用程序时,我得到以下异常。

线:3

评估项目':app'时出现问题。build_9zxr20k2zkn73ctdrehcrmd74.android()方法的签名不适用于参数类型:(build_9zxr20k2zkn73ctdrehcrmd74 _run_closure1美元)值:(build_9zxr20k2zkn73ctdrehcrmd74 _run_closure1@2ecd80美元)

org.gradle.api。GradleScriptException:计算时出现问题项目:应用程序。原因:groovy.lang.MissingMethodException: No方法:build_9zxr20k2zkn73ctdrehcrmd74.android()的签名为适用于参数类型:(build_9zxr20k2zkn73ctdrehcrmd74 _run_closure1美元)值:(build_9zxr20k2zkn73ctdrehcrmd74 _run_closure1@2ecd80美元)build_9zxr20k2zkn73ctdrehcrmd74.run

这是构建。gradle文件

构建。gradle(项目)

apply plugin: 'com.android.application'
android {
compileSdkVersion 31
defaultConfig {
applicationId "net.estebanrodriguez.anecdotals"
minSdkVersion 22
targetSdkVersion 31
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true
javaCompileOptions.annotationProcessorOptions.includeCompileClasspath true
}
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])

testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
//material design components
implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
implementation 'androidx.core:core:1.7.0-rc01'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.media:media:1.4.3'
implementation 'androidx.fragment:fragment:1.4.0-alpha10'
implementation 'androidx.appcompat:appcompat:1.4.0-beta01'
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'com.google.android.material:material:1.4.0'
implementation 'com.google.android.material:material:1.4.0'
//Firebase
implementation 'com.google.firebase:firebase-auth:21.0.1'
implementation 'com.google.firebase:firebase-firestore:23.0.4'
//Android Architecture Components
def room_version = '2.0.0-beta01'
implementation "androidx.room:room-runtime:$room_version"
annotationProcessor "androidx.room:room-compiler:$room_version"
// optional - RxJava support for Room
implementation "androidx.room:room-rxjava2:$room_version"
// Test helpers
testImplementation "androidx.room:room-testing:$room_version"
def lifecycle_version = '2.0.0-beta01'
// ViewModel and LiveData
implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle_version"
implementation 'androidx.multidex:multidex:2.0.1'
//Timber
implementation 'com.jakewharton.timber:timber:4.7.1'
//Dagger 2
implementation 'com.google.dagger:dagger-android:2.35.1'
implementation 'com.google.dagger:dagger-android-support:2.20'
// if you use the support libraries
annotationProcessor 'com.google.auto.value:auto-value:1.5.2'
annotationProcessor 'com.google.dagger:dagger-android-processor:2.20'
annotationProcessor 'com.google.dagger:dagger-compiler:2.21'
//RxJava
implementation 'io.reactivex.rxjava2:rxandroid:2.2.6'
// Because RxAndroid releases are few and far between, it is recommended you also
// explicitly depend on RxJava's latest version for bug fixes and new features.
// (see https://github.com/ReactiveX/RxJava/releases for latest 2.x.x version)
implementation 'io.reactivex.rxjava2:rxjava:2.2.6'
}
apply plugin: 'com.google.gms.google-services'

build.gradle(模块)

apply plugin: 'com.android.application'
android {
compileSdkVersion 31
defaultConfig {
applicationId "net.estebanrodriguez.anecdotals"
minSdkVersion 22
targetSdkVersion 31
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true
javaCompileOptions.annotationProcessorOptions.includeCompileClasspath true
}
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])

testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
//material design components
implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
implementation 'androidx.core:core:1.7.0-rc01'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.media:media:1.4.3'
implementation 'androidx.fragment:fragment:1.4.0-alpha10'
implementation 'androidx.appcompat:appcompat:1.4.0-beta01'
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'com.google.android.material:material:1.4.0'
implementation 'com.google.android.material:material:1.4.0'
//Firebase
implementation 'com.google.firebase:firebase-auth:21.0.1'
implementation 'com.google.firebase:firebase-firestore:23.0.4'
//Android Architecture Components
def room_version = '2.0.0-beta01'
implementation "androidx.room:room-runtime:$room_version"
annotationProcessor "androidx.room:room-compiler:$room_version"
// optional - RxJava support for Room
implementation "androidx.room:room-rxjava2:$room_version"
// Test helpers
testImplementation "androidx.room:room-testing:$room_version"
def lifecycle_version = '2.0.0-beta01'
// ViewModel and LiveData
implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle_version"
implementation 'androidx.multidex:multidex:2.0.1'
//Timber
implementation 'com.jakewharton.timber:timber:4.7.1'
//Dagger 2
implementation 'com.google.dagger:dagger-android:2.35.1'
implementation 'com.google.dagger:dagger-android-support:2.20'
// if you use the support libraries
annotationProcessor 'com.google.auto.value:auto-value:1.5.2'
annotationProcessor 'com.google.dagger:dagger-android-processor:2.20'
annotationProcessor 'com.google.dagger:dagger-compiler:2.21'
//RxJava
implementation 'io.reactivex.rxjava2:rxandroid:2.2.6'
// Because RxAndroid releases are few and far between, it is recommended you also
// explicitly depend on RxJava's latest version for bug fixes and new features.
// (see https://github.com/ReactiveX/RxJava/releases for latest 2.x.x version)
implementation 'io.reactivex.rxjava2:rxjava:2.2.6'
}
apply plugin: 'com.google.gms.google-services'

也许删除项目目录中以.开头的目录,如.gradle.idea可以工作。同时删除app目录下的build文件夹

相关内容

  • 没有找到相关文章

最新更新