Could not find com.google.gms: google-services: 4.0.1

2

I am trying to add Firebase to my Android project, I follow the steps indicated in the wizard to add it to your Android application and it gives an error when it did the Gradle synchronization.

I add the file google-serviles.json to my android project

I add the following lines

Once the previous lines of Android Studio have been added, I get the following error:

    Could not find com.google.gms:google-services:4.0.1.
Searched in the following locations:
    https://dl.google.com/dl/android/maven2/com/google/gms/google-services/4.0.1/google-services-4.0.1.pom
    https://dl.google.com/dl/android/maven2/com/google/gms/google-services/4.0.1/google-services-4.0.1.jar
    https://jcenter.bintray.com/com/google/gms/google-services/4.0.1/google-services-4.0.1.pom
    https://jcenter.bintray.com/com/google/gms/google-services/4.0.1/google-services-4.0.1.jar
Required by:
    project :

and as you can see I have the Gradle files as indicated by the step of adding Firebase to Android

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

buildscript {

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
        classpath 'com.google.gms:google-services:4.0.1'

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

allprojects {
    repositories {
        google()
        jcenter()
    }
}

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

build.gradle - app

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.example.luisalbertomurciasolivella.pruebanotificaciones"
        minSdkVersion 26
        targetSdkVersion 28
        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:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation 'com.google.firebase:firebase-core:16.0.1'
}

apply plugin: 'com.google.gms.google-services'
    
asked by Luis Alberto Murcia Solivella 10.12.2018 в 18:57
source

1 answer

1

Currently the problem is being investigated, you can check a similar question that was opened today

link

As Doug Stevenson (a person who works at Firebase) says

  

It is assumed that the add-on is available in the repository of   Google. However, something is currently wrong with that. The problem   is being investigated.

You can see an issue tracker in the following link about the problem

link

A short-term solution while this problem is fixed is the following

add the following line under repositories in Build Gradle (project module)

buildscript {
repositories {
    jcenter()
    google()
    maven { url 'https://dl.bintray.com/android/android-tools' }
}

and in the next one

allprojects {
    repositories {
        jcenter()
        maven {
            url 'https://maven.google.com/'
        }
        google()
    }
}
    
answered by 10.12.2018 / 20:01
source