Android Gradle build error: Caused by: groovy.lang.MissingMethodException: No signature of method

Viewed 1235

I'm getting the following exception when Android studio gradle tries to build my app.

line: 3

A problem occurred evaluating project ':app'. No signature of method: build_9zxr20k2zkn73ctdrehcrmd74.android() is applicable for argument types: (build_9zxr20k2zkn73ctdrehcrmd74$_run_closure1) values: [build_9zxr20k2zkn73ctdrehcrmd74$_run_closure1@2ecd80]

org.gradle.api.GradleScriptException: A problem occurred evaluating project ':app'. Caused by: groovy.lang.MissingMethodException: No signature of method: build_9zxr20k2zkn73ctdrehcrmd74.android() is applicable for argument types: (build_9zxr20k2zkn73ctdrehcrmd74$_run_closure1) values: [build_9zxr20k2zkn73ctdrehcrmd74$_run_closure1@2ecd80] at build_9zxr20k2zkn73ctdrehcrmd74.run

Here are the build.gradle files

build.gradle (Project)

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(Module)

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'
1 Answers

Maybe deleting directories in project directory that start with . like .gradle and .idea can work. Also delete build folder in app directory.

Related