0

My game stops when I try to connect it with the google play games. It was working. But suddenly this is happening. It's showing development error occurred. Here's the logcat.

07:34.150 2144-2144/com.sennovations.countermaster E/AndroidRuntime: FATAL EXCEPTION: main
                                                                          Process: com.sennovations.countermaster, PID: 2144
                                                                          java.lang.IllegalStateException: A fatal developer error has occurred. Check the logs for further information.
                                                                              at com.google.android.gms.common.internal.zze.zzs(Unknown Source)
                                                                              at com.google.android.gms.common.internal.zzi.zzrk(Unknown Source)
                                                                              at com.google.android.gms.common.internal.zzh.handleMessage(Unknown Source)
                                                                              at android.os.Handler.dispatchMessage(Handler.java:111)
                                                                              at android.os.Looper.loop(Looper.java:194)
                                                                              at android.app.ActivityThread.main(ActivityThread.java:5637)
                                                                              at java.lang.reflect.Method.invoke(Native Method)
                                                                              at java.lang.reflect.Method.invoke(Method.java:372)
                                                                              at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:959)
                                                                              at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:754)

I have added the meta tags in the manifest.

<meta-data android:name="com.google.android.gms.games.APP_ID" android:value="@string/app_id" />
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />

Any help would be appreciated. Thanks

Bera
  • 145
  • 1
  • 2
  • 11
  • Possible duplicate of https://stackoverflow.com/questions/16595225/initializing-games-client-in-android – Mr.Rebot Jul 02 '17 at 16:24
  • nope. Had everything done. Anyway I fixed it. There was a issue with the apk. Instead of building signed apk, I was directly running it on a device. – Bera Jul 02 '17 at 18:12

1 Answers1

0

Based on your comments I infer that this wasn't your issue, but as I encountered a similar error that I resolved as follows, I'll add this answer:

Google's documentation (here, for instance) currently instructs us to add

compile 'com.google.android.gms:play-services:11.0.4'

to build.gradle. Notice that it currently advises version 11.0.4. Google adds:

Be sure you update this version number each time Google Play services is updated.

This one line appears to be quite possibly some of the worst advice ever given.

Why? Two reasons.

  1. Suppose you use their free BaseGameUtils, which Google itself encourages. Its build.gradle is set up to use version 8.4.0:

      ext.gms_library_version = '8.4.0'
    

    I did this, and used the webpage's advice to use version 11.0.4. The disagreement in library numbers caused the app to crash on both Android Studio emulator and a test device with a stack trace similar to the one above.

    To be fair, Android Studio will warn you that things can go wrong with the different version numbers: if you open the Manifest file, it will underline the version numbers and whine that it finds two different version numbers, and it will even tell you which version numbers disagree, but -- this is key -- it won't tell you where to find the other file(s) with different version numbers. If you are importing several libraries, and/or compiling dependencies on GitHub or elsewhere, it can be a bit of a challenge to find the cause.

  2. If your app requests Play Games services 11.0.4, but your emulator and/or phone have a lower version number (e.g., 11.0.2 as on my emulator), then the Games API's connect() will give status RESULT_CANCEL to onActivityResult(). The documentation on these result codes leaves something to be desired, so this can take a while to debug -- in fact, I think I think the crashes above were my only clue that the problem might be with the API version number.

    There is a way to check that the device supports the requested API, but most of Google's documentation doesn't tell you to do it, and even BaseGameUtils doesn't seem to check for it. (You want to look at GoogleApiAvailability.GOOGLE_PLAY_SERVICES_VERSION_CODE.)

    In my particular case, the problem was solved by changing my app's play-services version to 8.4.0. Works beautifully now.

John Perry
  • 2,497
  • 2
  • 19
  • 28