![](/img/trans.png)
[英]IllegalArgumentException: Receiver not registered: com.google.android.gms.common.api
[英]Integrating Google Snapshot API to Android App causes in com.google.android.gms.common.api.ResolvableApiException: 4: 4:
我目前正在开发一个Android应用。 它已经使用了Google Play游戏(排行榜,成就和TurnBased-Multiplayer已经集成并且可以正常工作)。 现在,我想保存一些GameData,并在其中使用Snapshot API。
我总是签署发行版本并将其上传到Google Play上以供一组测试人员使用,并且在我尝试添加Snapshot API之前,它们都工作正常。
我做了什么:
private void signInToGoogle() {
mGoogleClient = GoogleSignIn.getClient(this,
new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_GAMES_SIGN_IN)
.requestScopes(Drive.SCOPE_APPFOLDER)
.build());
signInSilently();
}
private void signInSilently() {
System.out.println("A7DE signInSilently()");
mGoogleClient.silentSignIn().addOnCompleteListener(this,
new OnCompleteListener<GoogleSignInAccount>() {
@Override
public void onComplete(@NonNull Task<GoogleSignInAccount> task) {
if (task.isSuccessful()) {
System.out.println("A7DE signInSilently(): success");
onConnected(task.getResult());
} else {
System.out.println("A7DE signInSilently(): failure "+task.getException());
Log.e(TAG, "Exception: "+Log.getStackTraceString(task.getException()));
onDisconnected();
}
}
});
}
有了该代码,Logcat会说:
09-06 13:59:15.632 14860-14860/? I/System.out: A7DE signInSilently(): failure com.google.android.gms.common.api.ResolvableApiException: 4: 4:
09-06 13:59:15.633 14860-14860/? E/StatsACT: Exception: com.google.android.gms.common.api.ResolvableApiException: 4: 4:
at com.google.android.gms.common.internal.ApiExceptionUtil.fromStatus(Unknown Source)
at com.google.android.gms.common.internal.zzk.convert(Unknown Source)
at com.google.android.gms.common.internal.zzl.onComplete(Unknown Source)
at com.google.android.gms.common.api.internal.BasePendingResult.zza(Unknown Source)
at com.google.android.gms.common.api.internal.BasePendingResult.setResult(Unknown Source)
at com.google.android.gms.auth.api.signin.internal.zzk.zzd(Unknown Source)
at com.google.android.gms.auth.api.signin.internal.zzu.dispatchTransaction(Unknown Source)
at com.google.android.gms.internal.auth.zze.onTransact(Unknown Source)
at android.os.Binder.execTransact(Binder.java:573)
09-06 13:59:15.633 14860-14860/? I/System.out: A7DE disconnected...
为了使其更加听不清,这仅在S6 Android 7上引发Error。还在A5 Android 8上对其进行了测试,并且在这里完美运行...
对我来说,这是一个非常罕见的问题,但希望您能帮助我找到解决方案。
提前致谢
我找到了解决方案。 问题是未授予S6使用Google云端硬盘的权限。 现在,我首先要检查用户是否已授予许可,然后使用Drive.SCOPE_APPFOLDER打开GoogleSignInClient。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.