pcf*_*eek 21 android google-api google-oauth
在Android中实施Google登录时,我无法使用GoogleSignIn(com.google.android.gms.auth.api.signin.GoogleSignIn )和GoogleSignInClient(com.google.android.gms.auth.api.signin.GoogleSignInClient) Studio虽然我可以访问App中的其他类
com.google.android.gms.auth.api.signin.GoogleSignInAccount;
com.google.android.gms.auth.api.signin.GoogleSignInOptions;
com.google.android.gms.common.SignInButton;
Run Code Online (Sandbox Code Playgroud)
我的build.gradle(app)文件的精简版本如下
android {
}
dependencies {
compile 'com.google.android.gms:play-services-auth:11.4.2'
compile('com.google.api-client:google-api-client-android:1.23.0') {
exclude group: 'org.apache.httpcomponents'
}
compile('com.google.apis:google-api-services-gmail:v1-rev72-1.23.0') {
exclude group: 'org.apache.httpcomponents'
}
implementation 'com.google.gms:google-services:3.1.2'
}
apply plugin: 'com.google.gms.google-services'
Run Code Online (Sandbox Code Playgroud)
我的build.gradle(包)是
buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
classpath 'com.google.gms:google-services:3.1.2'
}
}
Run Code Online (Sandbox Code Playgroud)
任何帮助,将不胜感激
小智 19
将此添加到您的应用级依赖项
compile 'com.google.android.gms:play-services-auth:12.0.1'
Run Code Online (Sandbox Code Playgroud)
Kar*_*rma 14
我遇到了同样的问题
GoogleSignIn和GoogleSignInClient是在Google Play服务SDK版本11.6中引入的.在旧版本中使用了GoogleApiClient.
因此,请尝试将编译'com.google.android.gms:play-services-auth:11.4.2'更改为 'com.google.android.gms:play-services-auth:12.0.1'中的依赖项
依赖{
compile 'com.google.android.gms:play-services-auth:12.0.1'
}
对我来说,我正在应用程序的build.gradle中为Google Play服务应用插件:
apply plugin: 'com.google.gms.google-services'
Run Code Online (Sandbox Code Playgroud)
以及在我的项目的Build.gradle中,我使用了Google服务。
buildscript {
ext.kotlin_version = '1.1.60'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.google.gms:google-services:3.1.2' // <== this guy
classpath 'com.android.tools.build:gradle:3.0.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
Run Code Online (Sandbox Code Playgroud)
我记得我添加了一些编译问题。但是显然我不需要它们。
通过删除它们,我发现gms版本不再存在问题。
编辑
因此,删除最初解决了我的问题,但后来在Google登录后给了我一些问题。在我的项目底部添加了apply插件:“ com.google.gms.google-services”(而不是顶部)确实可以解决问题。
小智 1
不能用新版本吗?例如11.6.0。也尝试更新您的 Google 存储库。(工具->Android->SDK Manager->支持存储库下的SDK工具)
| 归档时间: |
|
| 查看次数: |
20414 次 |
| 最近记录: |