[android] Plugin with id 'com.google.gms.google-services' not found

I have followed this link to integrate ads in my app. But it shows this error:

error image

This is my build.gradle:

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 24
buildToolsVersion "24.0.2"





defaultConfig {
    applicationId "com.example.personal.numbermania"
    minSdkVersion 10
    targetSdkVersion 24
    versionCode 1
    versionName "1.0"
}
buildTypes {
    debug
            {
                debuggable true
            }
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}


dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:24.2.1'
    compile 'com.android.support:design:24.2.1'
    compile 'com.google.firebase:firebase-ads:9.6.0'

}

}

ads are not showing up in real device.please help me This is my error after i updated classpath error

This question is related to android firebase admob

The answer is


simply add "classpath 'com.google.gms:google-services:3.0.0'" to android/build.gradle to look like this

buildscript {
    repositories {
        maven {
            url "https://maven.google.com"
        }
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
        classpath 'com.google.gms:google-services:3.0.0'

       // NOTE: Do not place your application dependencies here; they belong
       // in the individual module build.gradle files

    }
}

and also add "apply plugin: 'com.google.gms.google-services'" to the end of file in android/app/build.gradle to look like this

apply plugin: 'com.google.gms.google-services'

You can find the correct dependencies here apply changes to app.gradle and project.gradle and tell me about this, greetings!


Your apply plugin: 'com.google.gms.google-services' in app.gradle looks like this:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 24
    buildToolsVersion "24.0.2"

    defaultConfig {
        applicationId "com.example.personal.numbermania"
        minSdkVersion 10
        targetSdkVersion 24
        versionCode 1
        versionName "1.0"

        multiDexEnabled true
    }

    dexOptions {
        incremental true
        javaMaxHeapSize "4g" //Here stablished how many cores you want to use your android studi 4g = 4 cores
    }

    buildTypes {
        debug
                {
                    debuggable true
                }
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
        compile fileTree(include: ['*.jar'], dir: 'libs')
        testCompile 'junit:junit:4.12'
        compile 'com.android.support:appcompat-v7:24.2.1'
        compile 'com.android.support:design:24.2.1'
        compile 'com.google.firebase:firebase-ads:9.6.1'
        compile 'com.google.firebase:firebase-core:9.6.1'
        compile 'com.google.android.gms:play-services:9.6.1'
}

apply plugin: 'com.google.gms.google-services'

Add classpath to the project's gradle:

classpath 'com.google.gms:google-services:3.0.0'

Google play services library on SDK Manager:

enter image description here


In the app build.gradle dependency, you must add the following code

classpath 'com.google.gms:google-services:$last_version'

And then please check the Google Play Service SDK tools installing status.


I'm not sure about you, but I spent about 30 minutes troubleshooting the same issue here, until I realized that the line for app/build.gradle is:

apply plugin: 'com.google.gms.google-services'

and not:

apply plugin: 'com.google.gms:google-services'

Eg: I had copied that line from a tutorial, but when specifying the apply plugin namespace, no colon (:) is required. It's, in fact, a dot. (.).

Hey... it's easy to miss.


apply plugin: 'com.google.gms.google-services'

add above line at the bottom of your app gradle.build.


Had the same problem.

adding this to my dependency didn't solve

classpath 'com.google.gms:google-services:3.0.0'

Adding this solved for me

classpath 'com.google.gms:google-services:+'

to the root build.gradle.


Go To Setting > Android SDK > SDK Tools > Google Play Services

enter image description here


I changed google-services classpath version from 4.2.0 to 3.0.0

classpath 'com.google.gms:google-services:3.0.0'

Then rebuild the project, Then strangely it suggested me to add firebase core to the project.

Then I added firebase core on the app(module)

implementation 'com.google.firebase:firebase-messaging:16.0.8'

Then the error disappeared magically.


Add classpath com.google.gms:google-services:3.0.0 dependencies at project level build.gradle

Refer the sample block from project level build.gradle

buildscript {
    repositories {
        jcenter()
    }
    dependencies {

        classpath 'com.android.tools.build:gradle:2.3.3'
        classpath 'com.google.gms:google-services:3.0.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

Had the same problem.

Fixed by adding the dependency

classpath 'com.google.gms:google-services:3.0.0'

to the root build.gradle.

https://firebase.google.com/docs/android/setup#manually_add_firebase


In build.gradle(Module:app) add this code

dependencies {
    ……..
    compile 'com.google.android.gms:play-services:10.0.1’
    ……  
}

If you still have a problem after that, then add this code in build.gradle(Module:app)

defaultConfig {
    ….
    …...
    multiDexEnabled true
}


dependencies {
    …..
    compile 'com.google.android.gms:play-services:10.0.1'
    compile 'com.android.support:multidex:1.0.1'
}

Examples related to android

Under what circumstances can I call findViewById with an Options Menu / Action Bar item? How to implement a simple scenario the OO way My eclipse won't open, i download the bundle pack it keeps saying error log getting " (1) no such column: _id10 " error java doesn't run if structure inside of onclick listener Cannot retrieve string(s) from preferences (settings) strange error in my Animation Drawable how to put image in a bundle and pass it to another activity FragmentActivity to Fragment A failure occurred while executing com.android.build.gradle.internal.tasks

Examples related to firebase

How can I solve the error 'TS2532: Object is possibly 'undefined'? Getting all documents from one collection in Firestore FirebaseInstanceIdService is deprecated Failed to resolve: com.google.firebase:firebase-core:16.0.1 NullInjectorError: No provider for AngularFirestore Firestore Getting documents id from collection How to update an "array of objects" with Firestore? firestore: PERMISSION_DENIED: Missing or insufficient permissions Cloud Firestore collection count iOS Swift - Get the Current Local Time and Date Timestamp

Examples related to admob

Plugin with id 'com.google.gms.google-services' not found Error "library not found for" after putting application in AdMob Does this app use the Advertising Identifier (IDFA)? - AdMob 6.8.0 error: No resource identifier found for attribute 'adSize' in package 'com.google.example' main.xml How can I get device ID for Admob