Uday
Uday

Reputation: 1484

Getting "ERROR: Plugin with id 'com.google.gms.google-services' not found" error

All of sudden i am unable to build my android app.

Following is my app level build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    buildToolsVersion "28.0.3"
    defaultConfig {
        applicationId "com.udayrepo.classelearn"
        minSdkVersion 16
        targetSdkVersion 28
        versionCode 20
        versionName "0.5.6"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        multiDexEnabled true

    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
    }

    android {
        lintOptions {
            warning 'DuplicatePlatformClasses'
        }
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'com.google.firebase:firebase-core:16.0.1'
    implementation 'com.google.firebase:firebase-config:11.8.0'
    implementation 'com.google.firebase:firebase-ads:15.0.0'
    implementation 'com.google.firebase:firebase-messaging:17.0.0'
    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.google.android.gms:play-services-ads:11.8.0'
    implementation 'com.github.PhilJay:MPAndroidChart:v3.0.3'
    implementation 'com.google.apis:google-api-services-youtube:v3-rev206-1.25.0'
    implementation 'junit:junit:4.12'
    implementation files('libs/YouTubeAndroidPlayerApi.jar')
    implementation 'com.android.support:multidex:1.0.3'
    implementation 'com.android.support:cardview-v7:28.+'
    implementation('com.foursquare:foursquare-android-oauth:1.0.3') {
        exclude group: 'com.google.android'
    }

    implementation 'com.android.volley:volley:1.1.1'

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

Below is my project level guild.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        google()   //  <--here
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
    }
}

allprojects {
    repositories {
        google()   //  <-- here
        jcenter()
    }
}

When i sync, i am getting below error: ERROR: Plugin with id 'com.google.gms.google-services' not found.

Upvotes: 1

Views: 6146

Answers (1)

Gabriele Mariotti
Gabriele Mariotti

Reputation: 363825

You have to add the google-services plugin to your build.gradle file.
In your top level file add:

buildscript {
  //....
  dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
        classpath 'com.google.gms:google-services:4.3.3'
    }
}

Upvotes: 2

Related Questions