简体   繁体   English

Google Play 服务游戏无提示登录错误 'com.google.android.gms.common.api.ApiException: 4:'

[英]Google play service game Silent Login error 'com.google.android.gms.common.api.ApiException: 4: '

am using google play services silent login, but it always CompleteListener show com.google.android.gms.common.api.ApiException: 4: 'SIGN_IN_REQUIRED' but am a test user in my application.我使用谷歌播放服务静默登录,但它总是 CompleteListener 显示 com.google.android.gms.common.api.ApiException: 4: 'SIGN_IN_REQUIRED' 但我的应用程序中的测试用户。 My code is below,我的代码在下面,

 @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mGoogleSignInClient = GoogleSignIn.getClient(this, new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_GAMES_SIGN_IN).build());
}

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

private void signInSilently() {

    mGoogleSignInClient.silentSignIn().addOnCompleteListener(this, new OnCompleteListener<GoogleSignInAccount>() {
    @Override
       public void onComplete(@NonNull Task<GoogleSignInAccount> task) {
           if (task.isSuccessful()) {
              try {
                   GoogleSignInAccount signInAccount = task.getResult(ApiException.class);
              } catch (ApiException apiException) {
                   System.out.println("CATE_RESULT_CODE " + apiException.getLocalizedMessage()+" " +apiException.getStatusMessage()+ " " +apiException.getMessage()+ " "+apiException.getCause() );
              }
           } else {
                try {
                    GoogleSignInAccount signInAccount = task.getResult(ApiException.class);
                } catch (ApiException apiException) {
                      System.out.println("CATE_RESULT_CODE " + apiException.getLocalizedMessage()+" " +apiException.getStatusMessage()+ " " +apiException.getMessage()+ " "+apiException.getCause() );
                }
           }
        }
     });
  }

My gradle file dependencies :我的 gradle 文件依赖项:

dependencies {
 ext {
    support_library_version = '27.0.2'
    google_play_services_version = '15.0.2'
  }
    implementation "com.android.support:appcompat-v7:${support_library_version}"
    implementation "com.android.support:design:${support_library_version}"
     implementation "com.android.support:recyclerview-v7:${support_library_version}"
     implementation "com.android.support:cardview-v7:${support_library_version}"
     implementation 'com.google.android.gms:play-services-auth:15.0.1'
     implementation 'com.google.android.gms:play-services-games:15.0.1'
 }

 erorr :
  com.google.android.gms.common.api.ApiException: 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:404)
    at dalvik.system.NativeStart.run(Native Method)

also adding app id in Manifest file.还在清单文件中添加应用程序 ID。

Please give me a solution for this problem.请给我一个解决这个问题的方法。 Advance thanks提前致谢

error will be solved...错误将被解决...

Anyone having this type of problem please check first your SHA 1 key from your Firebase project settings.遇到此类问题的任何人请先检查您的 Firebase 项目设置中的 SHA 1 密钥。

My SHA 1 key is mismatched from Firebase project settings.我的 SHA 1 密钥与 Firebase 项目设置不匹配。

Now am change that and work perfectly..现在我改变它并完美地工作..

Thank you..谢谢..

Follow this steps until you get the SHA-1 in Android Studio按照以下步骤操作,直到您在 Android Studio 中获得 SHA-1

https://stackoverflow.com/a/33479550/7772358 https://stackoverflow.com/a/33479550/7772358

Then go to this link然后去这个链接

https://console.firebase.google.com/ https://console.firebase.google.com/

  1. Click setting gear Icon near the Project Overview under Firebase Logo on the left top单击左上角 Firebase 徽标下项目概述附近的设置齿轮图标
  2. Click on the Project setting and make sure you choose the right Project in the dropdown list In the General tab.单击“项目”设置并确保在“常规”选项卡的下拉列表中选择正确的项目。
  3. Scroll down and find the SHA certificate fingerprints向下滚动并找到 SHA 证书指纹
  4. Click Add Fingerprint Copy and paste the SHA-1 from the Android studio console to the Certificate fingerprint column then click Save单击添加指纹从 Android Studio 控制台复制并粘贴 SHA-1 到证书指纹列,然后单击保存
  5. Restart the App that require firebase and google login.重新启动需要 firebase 和 google 登录的应用程序。

Viola.中提琴。

it turns out whenver you add/edit your Firebase app settings (SHA certificate fingerprints) it generate the correlate credentials in your application Google Api console.事实证明,每当您添加/编辑Firebase应用设置(SHA 证书指纹)时,它都会在您的应用Google Api控制台中生成相关凭据。 Although the fingerprint was the same it didnt work until i deleted the cradential from Google Api and let Firebase generate it for me - i guess its ID related.尽管指纹是相同的,但直到我从 Google Api 中删除了凭据并让 Firebase 为我生成它之后,它才起作用 - 我猜它的 ID 相关。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 谷歌玩服务游戏signInSilently()失败错误'com.google.android.gms.common.api.ApiException:4:4' - Google play service game signInSilently() FAILED error 'com.google.android.gms.common.api.ApiException: 4: 4 ' 带有com.google.android.gms.common.api.ApiException的Google Awareness API位置:7508 - Google Awareness API Places with com.google.android.gms.common.api.ApiException: 7508 Android Google 登录失败 com.google.android.gms.common.api.ApiException: 12500 - Android Google Sign In Failed com.google.android.gms.common.api.ApiException: 12500 获取自动完成预测 API 调用时出错:com.google.android.gms.common.api.ApiException: 9003: PLACES_API_ACCESS_NOT_CONFIGURED - Error getting autocomplete prediction API call: com.google.android.gms.common.api.ApiException: 9003: PLACES_API_ACCESS_NOT_CONFIGURED Unhandled Exception: PlatformException (sign_in_failed, com.google.android.gms.common.api.ApiException: 10: , null, null) - works well in one system - Unhandled Exception: PlatformException (sign_in_failed, com.google.android.gms.common.api.ApiException: 10: , null, null) - works well in one system IllegalArgumentException:接收者未注册:com.google.android.gms.common.api - IllegalArgumentException: Receiver not registered: com.google.android.gms.common.api GOOGLE PLAY服务例外:com.google.android.gms.common.GooglePlayServicesUtil - GOOGLE PLAY SERVICES EXCEPTION: com.google.android.gms.common.GooglePlayServicesUtil 将Snapshot API与Android App集成会导致com.google.android.gms.common.api.ResolvableApiException:4:4: - Integrating Google Snapshot API to Android App causes in com.google.android.gms.common.api.ResolvableApiException: 4: 4: 错误:类型 com.google.android.gms.common.internal.zzg 被引用为来自`com.google.android.gms.internal.zzij`的接口 - Error: Type com.google.android.gms.common.internal.zzg is referenced as an interface from `com.google.android.gms.internal.zzij` Gradle 同步失败:com.google.android.gms:play-services-basement 和 com.google.firebase:firebase-common - Gradle sync fails: com.google.android.gms:play-services-basement and com.google.firebase:firebase-common
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM