Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio Gradle : Error:Configuration with name 'compile' not found

Tags:

android

gradle

My project refresh is failing with the error for the below gradle script: Error:Configuration with name 'compile' not found.

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.2'
        classpath 'com.google.gms:google-services:3.1.0'

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

allprojects {
    repositories {
        mavenCentral()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
apply plugin: 'com.google.gms.google-services'
like image 598
soumitra chatterjee Avatar asked Jul 02 '17 03:07

soumitra chatterjee


2 Answers

Remove apply plugin: 'com.google.gms.google-services' from project/build.gradle and put it in your app/build.gradle

apply plugin: 'com.android.application'
android {

...
..
}

dependencies {

....
..

}

apply plugin: 'com.google.gms.google-services'
like image 131
eurosecom Avatar answered Nov 14 '22 12:11

eurosecom


paste apply plugin: 'com.google.gms.google-services' at the bottom of build.gradle(module app) and compile 'com.google.firebase:firebase-core:12.0.0' into dependencies of build.graddle(module app)

remove plugin: 'com.google.gms.google-services' from build.gradle(project name)

like image 20
Romyull Islam Avatar answered Sep 22 '22 14:09

Romyull Islam