我尝试使用谷歌无声登录,但GoogleSignInClient类由于某种原因未定义。当我进入alt-enter时,它只是说"创建课程"不是进口类。感谢任何帮助,谢谢!
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'
答案 0 :(得分:0)
我通过更新文件
解决了这个问题build.gradle(Project:projectname)
在此特定部分
从:
classpath&#39; com.google.gms:google-services:3.1.1&#39;
使用:
classpath&#39; com.google.gms:google-services:3.3.1&#39;