Error: Could not find com.google.gms:google-services:1.0. when adding google service plugin in build.gradle in android studio

前端 未结 20 945
被撕碎了的回忆
被撕碎了的回忆 2020-12-03 04:12

I am integrating OAuth login for Google+ on my android application, following the tutorial.

According to the tutorial, I should add the Google Service plugin by addi

相关标签:
20条回答
  • 2020-12-03 04:53

    Google has updated GCM go check it and for that you have to update your Android Studio too.

    0 讨论(0)
  • 2020-12-03 04:54

    For me I had to switch the repository to jcenter(). I was using mavenCentral and getting this error. As soon as I switched to jcenter() it pulled the dependency down.

    To do this, open your build.gradle and replace each instance of mavenCentral() with jcenter()

    0 讨论(0)
  • 2020-12-03 04:54

    If you use Android Studio, try to add google service with the IDE.

    1. Right click on folder module.
    2. On left list at Developer Services choose desired service.
    3. Wait for syncing and the IDE will automatically add google dependecies.
    4. add classpath on buildscript

      buildscript { repositories { jcenter() } dependencies { classpath 'com.google.gms:google-services:1.3.0-beta1' } }

    0 讨论(0)
  • 2020-12-03 04:54

    You should just add classpath 'com.google.gms:google-services:1.3.0-beta1' to dependencies of your (Top level build file) the build.gradle that has the (Project:<name of your project). Hope this helps!

    0 讨论(0)
  • 2020-12-03 04:54

    I recently updated to Android Studio 2.3 and somehow apply plugin doesn't work.

    After that, I tried various ways and then what work is when I commented out app's build.gradle:

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

    and then I add this to top-level build.gradle (below classpath 'com.android.tools.build:gradle:2.2.3'):

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

    and then it works.

    0 讨论(0)
  • 2020-12-03 04:57

    I resolved this issue by doing the following things:

    1. In build.gradle (at project level):

      // Top-level build file where you can add configuration options common to all sub-projects/modules.
      
      buildscript {
          repositories {
              mavenCentral()
              jcenter()
          }
          dependencies {
              classpath 'com.android.tools.build:gradle:1.3.0'
              classpath 'com.google.gms:google-services:1.5.0-beta2'
           }
      }
      
      allprojects {
          repositories {
              mavenCentral()
          }
      }
      
    2. In build.gradle (at module level):

      On top added:

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

      and in dependecies added:

      compile 'com.google.android.gms:play-services-analytics:8.3.0'
      

    Apart from this make sure you have updated the Google Play services and Google repository in the SDK.

    0 讨论(0)
提交回复
热议问题