我正在尝试在我的移动应用程序中使用谷歌登录,但在遵循谷歌的教程后出现以下错误。
“无法解析:com.google.android.gms:play-services-auth:11.6.0”
我的 gradle 文件:
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
}
另一个是:
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'
}
那么这里出了什么问题以及为什么我无法构建该项目?
我遇到了同样的问题,我可以通过添加来解决它maven { url "https://maven.google.com" }
项目级别 build.gradle 中的存储库列表,如下所示。
allprojects {
repositories {
jcenter()
maven { url "https://maven.google.com" }
}
}
另外,请确保这一点apply plugin: 'com.google.gms.google-services'
位于您的依赖项之后以避免版本问题。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)