Error: A problem occurred Configuring root project 'Meuprojeto'

Asked

Viewed 1,381 times

1

I’m trying to use the Firebase of Android Studio but I made the settings as in Google site itself, and the message that appears to me is:

Gradle 'MeuProjeto' project refresh failed
Error:A problem occurred configuring root project 'Meu Projeto'.

Captura de tela mostrando o erro transcrito anteriormente no console do Android Studio

I ask for someone’s help, below my Gradle code.

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

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.0'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files

        // Add this line
        classpath 'com.google.gms:google-services:3.0.0'
    }
}

allprojects {
    repositories {
        jcenter()
    }

}

task clean(type: Delete) {
    delete rootProject.buildDir
}
// Add to the bottom of the file
apply plugin: 'com.google.gms.google-services'

Other Gradle Archive

apply plugin: 'com.android.application'

android {
    compileSdkVersion 24
    buildToolsVersion "24.0.0"
    defaultConfig {
        applicationId "bbac.cursoandroidstudio"
        minSdkVersion 19
        targetSdkVersion 24
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:24.0.0'
    compile 'com.android.support:design:24.0.0'
    testCompile 'junit:junit:4.12'
    compile 'com.google.firebase:firebase-messaging:9.6.1'
}

1 answer

0


Take this part of the build.Radle corresponding to the entire project (the first file you put in):

// Add to the bottom of the file
apply plugin: 'com.google.gms.google-services' 

So it stays that way:

.
.
.
allprojects {
    repositories {
        jcenter()
    }

}

task clean(type: Delete) {
    delete rootProject.buildDir
}

And put at the end of the module build.Radle (the second file you placed), so it looks like this:

.
.
.
dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:24.0.0'
    compile 'com.android.support:design:24.0.0'
    testCompile 'junit:junit:4.12'
    compile 'com.google.firebase:firebase-messaging:9.6.1'
}


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

Browser other questions tagged

You are not signed in. Login or sign up in order to post.