Gradle failed to execute com.google.android.gms: play-services-auth: 11.6.0

I'm trying to use Google to log in to my mobile application, but the following error appears after the next Google tutorial.

"failed to solve: com.google.android.gms: play-services-auth: 11.6.0"

My gradle files:

buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.2.3' 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 { jcenter() } } task clean(type: Delete) { delete rootProject.buildDir } 

and the other:

 apply plugin: 'com.android.application' apply plugin: 'com.google.gms.google-services' android { compileSdkVersion 25 buildToolsVersion "25.0.2" defaultConfig { applicationId "com.myapp.myapp" minSdkVersion 15 targetSdkVersion 25 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:25.1.0' testCompile 'junit:junit:4.12' compile 'com.google.android.gms:play-services-auth:11.6.0' } 

So what is wrong here and why can't I build a project?

+5
source share
3 answers

I had the same problem and I was able to solve it by adding maven { url "https://maven.google.com" } to the list of repositories at the project level build.gradle, as shown below.

 allprojects { repositories { jcenter() maven { url "https://maven.google.com" } } } 

Also, make sure that this apply plugin: 'com.google.gms.google-services' appears after your dependencies to avoid version issues.

+18
source

Problem Identification:

There is a conflict in the libraries version, you use 'com.google.android.gms:play-services-auth:11.6.0' , and the latest version is now , which requires compatible compileSdkVersion and targetSdkVersion

Why did this happen?:

Compiling lib contains a higher level of api than the level of your api application.

Decision:

Download compileSdkVersion and targetSdkVersion in the latest version (now it's 27 ) , and your com.android.support also compatible with all applications and libraries.

You should also add google() to your repositories:

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

Note: updating targetSdkVersion not required for this problem, but it is better to use the application to target a wide range of devices.

+1
source

Make sure you download GooglePlay services in SDK Manager

Please move this line:

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

at the end of the gradle file (it MUST be at the end)

Alternatively, you can upgrade versions:

 classpath 'com.android.tools.build:gradle:3.0.0' classpath 'com.google.gms:google-services:3.1.1' 

Add also google() in the repository:

  buildscript { repositories { jcenter() google() } dependencies { classpath 'com.android.tools.build:gradle:2.2.3' classpath 'com.google.gms:google-services:3.1.0'} } } allprojects { repositories { jcenter() google() } } task clean(type: Delete) { delete rootProject.buildDir } 
0
source

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


All Articles