将Google Snapshot API集成到Android应用程序会导致com.google.android.gms.common.api.ResolvableApiException:4:4:

问题描述 投票:0回答:1

我目前正在开发Android应用程序。它已经使用Google Play游戏(排行榜,成就和TurnBased-Multiplayer已经集成并且工作正常)。现在我想在我想要使用Snapshot API的地方保存一些GameData。

我总是签署一个发布版本并将其上传到谷歌播放一组测试人员,所有工作正常,直到我尝试添加快照API。

我做了什么:

  • 我在Play服务的Google Play控制台中将已保存的游戏设置为开启
  • 我在Google云平台上激活了Google云端硬盘API
  • 我将.requestScopes(Drive.SCOPE_APPFOLDER)添加到我的GoogleSignInMethode(这就是Error出现的原因)
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上的错误。还使用A5 Android 8进行了测试,并且在那里它完美运行...

对我来说这是一个非常罕见的问题,但我希望你能帮我找到解决方案。

提前致谢

java android google-play-services google-signin google-api-client
1个回答
0
投票

我为我找到了解决方案。问题在于未授权使用Google云端硬盘的S6权限。现在我首先检查用户是否已经授予了权限,而不是使用Drive.SCOPE_APPFOLDER打开Goog​​leSignInClient。

© www.soinside.com 2019 - 2024. All rights reserved.