How to fix the error: could not find com.google.gms: google-services: 3.0.0.?

I am trying to add addmob firebase to my application.

In build.gradle (Project) I have the following code

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

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

In build.gradle (module)

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "24.0.2"

    defaultConfig {
        applicationId "com.myname.examp.myapp"
        minSdkVersion 14
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.0.0'
    compile 'com.android.support:design:23.0.0'
    compile 'com.google.firebase: firebase-ads: 9.0.0'
}
apply plugin: 'com.google.gms.google-services'

I have an updated version of the google play service and repository enter image description here

When I sync the project, I still get the following error

Error:Could not find com.google.gms: google-services: 3.0.0.
Searched in the following locations:
    file:/C:/Program Files/Android/Android Studio2/gradle/m2repository/com/google/gms/ google-services/ 3.0.0/ google-services- 3.0.0.pom
    file:/C:/Program Files/Android/Android Studio2/gradle/m2repository/com/google/gms/ google-services/ 3.0.0/ google-services- 3.0.0.jar
    https://jcenter.bintray.com/com/google/gms/ google-services/ 3.0.0/ google-services- 3.0.0.pom
    https://jcenter.bintray.com/com/google/gms/ google-services/ 3.0.0/ google-services- 3.0.0.jar
Required by:
    :MyApplication:unspecified

Can someone help me how to fix this error?

+4
source share
6 answers

Add google-services.jsonto the application folder.

+5
source

I had a similar problem, I copied the dependency on firebase instructions and pasted it into the code.

From the instructions:

classpath 'com.google.gms: google-services: 3.0.0'

It is supposed:

classpath 'com.google.gms:google-services:3.0.0'

Do not include spaces. Stupid but wasted half an hour.

+5

gradle. , .

+3

build.gradle :

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

, build.gradle

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

build.gradle , , .

dependencies {
    classpath 'com.android.tools.build:gradle:2.3.1'
    classpath 'com.google.gms:google-services:3.+'

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

.

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

: org.gradle.api.internal.tasks.DefaultTaskInputs $TaskInputUnionFileCollection org.gradle.api.internal.file.collections.DefaultConfigurableFileCollection :

  • Gradle ( ). ( ).
  • Gradle () . Gradle . Gradle ( )
  • , Gradle, .
Gradle IDE, Java.
-2
source

Source: https://habr.com/ru/post/1654956/


All Articles