Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio error - groovy.lang.MissingMethodException: No signature of method: build_8sqj**q9.android() is applicable for argument types: ***

I prepared an android app in android studio then I copied my whole code manually from one sys to another. But after that, getting this error. Below are my both gradle files and screenshot.(Not sure why manisfest file is not shown in android studio, this might be related) Please dont mark copy as I have tried many solution from stackoverflow. those are same error but seems diff cause.

Module:app


    apply plugin: 'com.android.application'
    apply plugin: 'com.google.gms.google-services'
    
    android {
        compileSdkVersion 30
        buildToolsVersion '30.0.2'
        defaultConfig {
            applicationId "dhritiapps.tulsiramayan"
            minSdkVersion 23
            targetSdkVersion 30
            versionCode 23
            versionName 5.0
            multiDexEnabled true
            testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
            compileOptions {
                sourceCompatibility 1.8
                targetCompatibility 1.8
            }
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
        packagingOptions {
            exclude 'META-INF/DEPENDENCIES'
            exclude 'META-INF/NOTICE'
            exclude 'META-INF/LICENSE'
            exclude 'META-INF/LICENSE.txt'
            exclude 'META-INF/NOTICE.txt'
        }
    }
    
    dependencies {
        implementation fileTree(dir: 'libs', include: ['*.jar'])
        implementation 'androidx.legacy:legacy-support-v4:1.0.0'
        implementation 'androidx.navigation:navigation-fragment:2.2.1'
        implementation 'androidx.navigation:navigation-ui:2.2.1'
        implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
        implementation 'com.google.firebase:firebase-auth:20.0.1'
        implementation 'com.google.firebase:firebase-database:19.5.1'
        androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0', {
            exclude group: 'com.android.support', module: 'support-annotations'
        })
        implementation 'androidx.appcompat:appcompat:1.0.0'
        implementation 'com.google.android.material:material:1.0.0'
        implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
        implementation 'com.firebase:firebase-client-android:2.5.2'
        implementation 'com.google.android.gms:play-services-auth:18.1.0'
        implementation 'com.google.gms:google-services:4.3.4'
        implementation 'link.fls:swipestack:0.3.0'
        implementation 'com.airbnb.android:lottie:3.5.0'
        implementation 'com.github.bumptech.glide:glide:4.11.0'
        implementation platform('com.google.firebase:firebase-bom:26.2.0')
        implementation 'com.google.firebase:firebase-auth'
        implementation 'com.google.android.gms:play-services-auth:19.0.0'
        implementation 'me.priyesh:chroma:1.0.2'
        annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
        implementation 'com.squareup.picasso:picasso:2.5.2'
        testImplementation 'junit:junit:4.13'
        testImplementation 'org.codehaus.groovy:groovy-all:2.4.15'
    }

Project


    // Top-level build file where you can add configuration options common to all sub-projects/modules.
    buildscript {
        repositories {
            google()
            jcenter()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:4.1.1'
            classpath 'com.google.gms:google-services:4.3.4'
    
            // NOTE: do not place your application dependencies here; they belong
            // in the individual module build.gradle files
        }
    }
    
    allprojects {
        repositories {
            google()
            jcenter()
        }
    }
    
    task clean(type: Delete) {
        delete rootProject.buildDir
    }

like image 546
Pankaj Bhardwaj Avatar asked Apr 24 '21 11:04

Pankaj Bhardwaj


2 Answers

Well, I just was confronted to a similar problem, and actually it's the feedback of Gradle that is really REALLY bad. It's failing because of some invalid declaration inside the "android" block.

In your case, it seems that it's only because of the value you assign to versionName not being inside (double) quotes as a string must be.

So, in your :app gradle file, just fix this:

android {
    ...
    defaultConfig {
        ...
        versionName '5.0'
        ...
    }
    ...
}
like image 139
Mereo4 Avatar answered Oct 22 '22 15:10

Mereo4


Another possibility is that you might be using properties of some plugin inside android tag, which is not declared as plugin. In my case I was trying to use

firebaseCrashlytics {
                // If you don't need crash reporting for your debug build
                mappingFileUploadEnabled false
            }

without using below plugin

apply plugin: 'com.google.firebase.crashlytics'

Just by adding plugin the issue is resolved. Also please look for double quote and single quote string

like image 6
Vijay E Avatar answered Oct 22 '22 16:10

Vijay E