Home > front end >  Could not found plugin: 'com.google.gms.google-services'
Could not found plugin: 'com.google.gms.google-services'

Time:09-19

I'm new in Android. I am working on firebase app project I have already added google services plugin. But It showing me error: Could not found apply plugin google services.

app:gradle

apply plugin: 'com.android.application'

android {
  compileSdkVersion 32
  defaultConfig {
    applicationId "com.example.project.app"
    minSdkVersion 17
    targetSdkVersion 32
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner
   "android.support.test.runner.AndroidJUnitRunner"
  }

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

dependencies
{
  implementation fileTree(dir: 'libs', include: ['*.jar'])
  implementation 'com.android.support:appcompat-v7:26. '
  implementation 'com.android.support.constraint:constraint-layout:1.0.2'
  implementation 'com.google.firebase:firebase-core:16.0.1'
  implementation 'com.github.rey5137:material:1.2.5'
  implementation 'com.android.support:cardview-v7:26.1.0'
  implementation 'com.google.firebase:firebase-database:16.0.1'
  implementation 'io.paperdb:paperdb:2.6'
  testImplementation 'junit:junit:4.12'
  androidTestImplementation 'com.android.support.test:runner:1.0.1'
  androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
  implementation 'com.android.support:recyclerview-v7:26. '
}
apply plugin: 'com.gooogle.gms.google-services'

CodePudding user response:

You are new in Android.
So first try Invalidate Cachce Restart or clean project.

CodePudding user response:

In your project, you have two build.gradle files, one in the root folder and the other inside the app folder. You need to add this line of code to your build.gradle file in the root folder

If you use Gradle Kotlin DSL

plugins {
    id "com.android.application" version "7.2.1" apply false
    id "com.android.library" version "7.2.1" apply false
    id "com.google.gms.google-services" version "4.3.13" apply false
}

or

buildscript {
    repositories {
        mavenCentral()
        google()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:7.0.4'
        classpath 'com.google.gms:google-services:4.3.13'
    }
}

allprojects {
    repositories {
        mavenCentral()
        google()
    }
}

Only after that you can add and compile this in your build.gradle in your app folder:

If you use Gradle Kotlin DSL

plugins {
    id "com.android.application"
    id "com.google.gms.google-services"
}

or

apply plugin: 'com.gooogle.gms.google-services'
  • Related