应用打开时如何连接 Google Play 服务?

   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) 


RISEBY
浏览 226回答 1
1回答

qq_遁去的一_1

我解决了这个问题。我没有在清单文件中添加以下代码&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<meta-data&nbsp;android:name="com.google.android.gms.games.APP_ID" &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;android:value="@string/app_id"&nbsp;/>
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java