打开应用程序后如何连接Google Play服务?

时间:2019-01-23 23:52:50

标签: java google-play google-play-services

       protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
        setContentView(R.layout.ana_sayfa);


        apiClient = new GoogleApiClient.Builder(this)
                .addApi(Games.API)
                .addScope(Games.SCOPE_GAMES)
                .enableAutoManage(this, new GoogleApiClient.OnConnectionFailedListener() {
                    @Override
                    public void onConnectionFailed(@NonNull ConnectionResult connectionResult) {
                        Log.e("HATA", "Google Play Oyun servisine bağlanamadı.Lütfen bağlantınızı kontrol ediniz.");
                        finish();
                    }
                }).build();
}

我希望用户在打开应用程序时登录到Google Play服务。出现以下错误。

java.lang.IllegalStateException: A fatal developer error has occurred. Class name: zzf. Start service action: com.google.android.gms.games.service.START. Service Descriptor: com.google.android.gms.games.internal.IGamesService. at com.google.android.gms.common.internal.BaseGmsClient$zza.zza(Unknown Source:20) at com.google.android.grns.common.internal.BaseGmsClient$zzc.zzo(Unknown Source:11) at com.google.android.gms.common.internal.BaseGmsClient$zzb.handleMessage(Unknown Source:48) at android.os.Handler.dispatchMessage(Handler.java:105) at android.os.Looperloop(Looperjava:164) at android.app.ActivityThread.main(ActivityThread.java:6696) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.Zygote$MethodAndArgsCallerrun(Zygote.java:240) at com.android.internal.os.Zygotelnit.main(Zygotelnit.java:782) 

1 个答案:

答案 0 :(得分:0)

我解决了这个问题。我没有在清单文件中添加以下代码

json.decode(response.body)