我试图按照https://developers.google.com/identity/sign-in/android/start-integrating的说明进行操作 为我的应用程序创建一个Google登录按钮。但是,当我尝试使用
时compile 'com.google.android.gms:play-services-auth:11.6.2'
我收到错误"找不到com.google.android.gms:play-services-auth:11.6.2"。我遵循了类似问题的建议,并确保我的SDK是最新的,但没有运气。
项目构建:
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.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()
maven { url "https://jitpack.io" }
maven { url "https://maven.google.com" }
}
}
应用程序构建:
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "theproject.theapp"
minSdkVersion 19
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.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.google.android.gms:play-services-auth:11.6.2'
compile 'com.google.android.gms:play-services-maps:9.0.0'
compile 'com.google.maps:google-maps-services:0.1.20'
compile 'com.lorentzos.swipecards:library:1.0.9'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.makeramen:roundedimageview:2.3.0'
compile 'com.facebook.android:facebook-login:[4,5)'
testCompile 'junit:junit:4.12'
}
有什么建议吗?谢谢,
伊恩
答案 0 :(得分:3)
最新版 play-services-auth
compile 'com.google.android.gms:play-services-auth:11.6.0'
只需在 Gradle.Build
中更改它,就像compile 'com.google.android.gms:play-services-auth:11.6.2'
了解更多信息
<强> Start Integrating Google Sign-In into Your Android App 强>
答案 1 :(得分:3)
要使用编译'com.google.android.gms:play-services-auth:11.6.2',您应该执行以下步骤。
1)在build.gradle(模块)中替换:
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
使用:
compile 'com.android.support:appcompat-v7:25.4.0'
compile 'com.android.support:design:25.4.0'
compile 'com.android.support:cardview-v7:25.4.0'
2)在build.gradle(项目)中,您应该替换:
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.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()
maven { url "https://jitpack.io" }
maven { url "https://maven.google.com" }
}
}
使用:
buildscript {
repositories {
jcenter()
mavenCentral()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:3.1.0'
}
}
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
google()
}
}
答案 2 :(得分:1)
只需将google()添加到您的gradle存储库列表中,这就是现在找到的版本11.6.2。这样的事情:
<!-- Modal HTML -->
<div id="thankyouModal" class="modal fade">
<div class="modal-dialog modal-confirm">
<div class="modal-content">
<div class="modal-header">
<div class="icon-box">
<i class="material-icons"></i>
</div>
<h4 class="modal-title">Awesome!</h4>
</div>
<div class="modal-body">
<p class="text-center">Your booking has been confirmed. Check your email for detials.</p>
</div>
<div class="modal-footer">
<button class="btn btn-success btn-block" data-dismiss="modal">OK</button>
</div>
</div>
</div>
</div>
答案 3 :(得分:0)
只需将com.android.support更新为您的应用程序gradle中的版本25.4.0