gpt4 book ai didi

java - 为什么我无法导入 GoogleSignInClient 类?

转载 作者:太空宇宙 更新时间:2023-11-04 10:23:58 29 4
gpt4 key购买 nike

我正在尝试使用 google 无提示登录,但由于某种原因未定义 GoogleSignInClient 类。当我按 alt-enter 时,它只是说“创建类”而不是导入类。感谢任何帮助,谢谢!

enter image description here

private void signInSilently() {
GoogleSignInClient signInClient = GoogleSignIn.getClient(this, GoogleSignInOptions.DEFAULT_GAMES_SIGN_IN);
signInClient.silentSignIn().addOnCompleteListener(this,
new OnCompleteListener<GoogleSignInAccount>() {
@Override
public void onComplete(@NonNull Task<GoogleSignInAccount> task) {
if (task.isSuccessful()) {
// The signed in account is stored in the task's result.
GoogleSignInAccount signedInAccount = task.getResult();
} else {
// Player will need to sign-in explicitly using via UI
}
}
});
}

@Override
protected void onResume() {
super.onResume();
signInSilently();
}

另外:

implementation 'com.google.firebase:firebase-core:16.0.0'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.firebase:firebase-auth:16.0.1'
implementation 'com.google.android.gms:play-services-auth:15.0.1'
implementation 'com.google.android.gms:play-services-identity:15.0.1'

最佳答案

我已经通过更新文件解决了问题

build.gradle (Project: projectname)

在这个特定部分

来自:

classpath 'com.google.gms:google-services:3.1.1'

与:

classpath 'com.google.gms:google-services:3.3.1'

关于java - 为什么我无法导入 GoogleSignInClient 类?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50772547/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com