Gradle无法解析com.google.android.gms:play-services-auth:11.6.0 [英] Gradle failed to resolve com.google.android.gms:play-services-auth:11.6.0
问题描述
我试图在我的移动应用中使用Google登录,但在google的教程后出现以下错误。
I am trying to use google log in in my mobile app but I am getting following error after following google's tutorial.
失败以解决:com.google.android.gms:play-services-auth:11.6.0
"failed to resolve: com.google.android.gms:play-services-auth:11.6.0"
我的gradle文件:
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 one is :
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 I cannot build the project?
推荐答案
我有同样的问题,我可以通过添加 maven {urlhttps://maven.google.com}
到项目级别build.gradle中的存储库列表,如下所示。
I had the same issue and I was able to resolve it by adding maven { url "https://maven.google.com" }
to list of repositories in project level build.gradle as shown below.
allprojects {
repositories {
jcenter()
maven { url "https://maven.google.com" }
}
}
另外,请确保应用插件:'com.google。 gms.google-services的
出现在您的依赖关系之后,以避免版本问题。
Also, ensure this apply plugin: 'com.google.gms.google-services'
comes after your dependencies to avoid version issues.
这篇关于Gradle无法解析com.google.android.gms:play-services-auth:11.6.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!