android - 无法解析 GoogleSignInClient

标签 android

我正在尝试将 Google Sign-In 集成到 Android Studio 中,但无法使用 GoogleSignIn 和 GoogleSignInClient。我从类似问题中了解到 com.google.firebase:firebase-auth 版本至少应为“11.6.0”,但我的应用程序 build.gradle 中的版本更高(“16.0.3”),如您所见:

我的应用程序 build.gradle 依赖项:

 implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.google.firebase:firebase-auth:16.0.3'
    implementation 'com.google.android.gms:play-services-auth:16.0.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

我的项目build.gradle依赖项:

 dependencies {
        classpath 'com.android.tools.build:gradle:3.3.1'
        classpath 'com.google.gms:google-services:4.1.0'
}

如有任何帮助,我们将不胜感激。

最佳答案

import com.google.android.gms.auth.api.signin.GoogleSignIn;
import com.google.android.gms.auth.api.signin.GoogleSignInOptions;
import com.google.android.gms.auth.api.signin.GoogleSignInClient;

确保它们位于您的代码中。

在您的构建应用程序 gradle 文件中:

dependencies {    implementation 'com.google.firebase:firebase-auth:16.2.0'
implementation 'com.google.android.gms:play-services-auth:16.0.1'
implementation 'com.google.firebase:firebase-core:16.0.8'

}

在下面添加这个

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

对我有用。

关于android - 无法解析 GoogleSignInClient,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55434595/

相关文章:

android - 如何在 map 上显示比例尺和缩放控件?

android - 我只能用ViewPager向后翻页,不能向前翻页

Android - 如何覆盖 "Back"按钮,使其不会完成()我的 Activity ?

android - Android 手机锁定后互联网连接暂停

android - 在填充的 android Canvas 上绘制一个透明圆圈

android - 使用 aSmack 为 XMPP 群聊创建 MUC 房间时发生 ClassCastException

android - 在 Gridview 中使用 Viewflipper

android - 有没有办法为 SpannableString 设置文本阴影?

android - 火力地堡 Firestore : Is there a callback when there is no internet connection?

android - 验证 apk 是否为付费副本(避免盗版应用)