Initializing Games Client in Android

AndroidGoogle Play-Services

Android Problem Overview


I'm trying the new Google Play Game Services.

At first I followed this howto https://developers.google.com/games/services/android/quickstart and then finished this https://developers.google.com/games/services/android/init

I end up like this:

05-16 20:01:39.034: E/AndroidRuntime(18257): FATAL EXCEPTION: main
05-16 20:01:39.034: E/AndroidRuntime(18257): java.lang.IllegalStateException: A fatal developer error has occurred. Check the logs for further information.
05-16 20:01:39.034: E/AndroidRuntime(18257): 	at com.google.android.gms.internal.p$f.a(Unknown Source)
05-16 20:01:39.034: E/AndroidRuntime(18257): 	at com.google.android.gms.internal.p$f.a(Unknown Source)
05-16 20:01:39.034: E/AndroidRuntime(18257): 	at com.google.android.gms.internal.p$b.p(Unknown Source)
05-16 20:01:39.034: E/AndroidRuntime(18257): 	at com.google.android.gms.internal.p$a.handleMessage(Unknown Source)
05-16 20:01:39.034: E/AndroidRuntime(18257): 	at android.os.Handler.dispatchMessage(Handler.java:99)
05-16 20:01:39.034: E/AndroidRuntime(18257): 	at android.os.Looper.loop(Looper.java:137)
05-16 20:01:39.034: E/AndroidRuntime(18257): 	at android.app.ActivityThread.main(ActivityThread.java:5041)
05-16 20:01:39.034: E/AndroidRuntime(18257): 	at java.lang.reflect.Method.invokeNative(Native Method)
05-16 20:01:39.034: E/AndroidRuntime(18257): 	at java.lang.reflect.Method.invoke(Method.java:511)
05-16 20:01:39.034: E/AndroidRuntime(18257): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
05-16 20:01:39.034: E/AndroidRuntime(18257): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
05-16 20:01:39.034: E/AndroidRuntime(18257): 	at dalvik.system.NativeStart.main(Native Method)

I've tried to follow the tutorial step by step. I don't understand what is going wrong.

> ava.lang.IllegalStateException: A fatal developer error has occurred. Check the logs for further information.

I thought that logcat = logs and there is nothing more. So where can I find these "logs"?

My implementation is different only in one thing. I have a ClassA which extends BaseGameActivity and then ClassB which extends ClassA and implements View.OnClickListener So I have all methods from https://developers.google.com/games/services/android/init in class ClassB

Thanks for any help

Android Solutions


Solution 1 - Android

I had the same problem initially. What I had to do was look at the full, unfiltered LogCat log. There, I saw the message:

>GamesIntentService(17929): Using Google Play games services requires a metadata tag with the name "com.google.android.gms.games.APP_ID" in the application tag of your manifest

So, assuming you created an entry in your strings.xml called app_id, try adding the following to your AndroidManifest.xml under the <application> tag:

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

You can find your APP_ID in the Games Services tab

Games Services tab

Solution 2 - Android

Complementing Hetabiquo response, if you also use Cloud Save service in your game you also must to update your application's AndroidManifest.xml by adding the following meta-data tag inside <application> tag scope

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

Solution 3 - Android

Just had the same issue but had the meta-tag correct - I did look up the unfiltered logcat and found out, that it was searching for a different meta-tag.

The name of the meta-tag differs by the sort of Client Number you submitted in the GameHelper Constructor (if you use it).

new GameHelper(this, GameHelper.CLIENT_GAMES);

For me I accidentaly used CLIENT_ALL which leads to a wrong expectations of the meta-tag name. I changed it to CLIENT_GAMES and everything worked smoothly.

Solution 4 - Android

In addition to Hetabiquo, you can fin your APP_ID in the Games Services tab :

Games Services tab

Solution 5 - Android

I suffered from this bug for quite some time. I decided to go through the basegameutils package scanning each file one at a time. In gameHelperUtils class i found this method, getAppIdFromResource(). Inside it it requested app ID from resource. I remembered I had hardcoded the app ID in the manifest file. I then added a string resource of app_id in the strings file. To my amazement, the error was gone and the leaderboard showed up!

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionSemanticerView Question on Stackoverflow
Solution 1 - AndroidHetabiquoView Answer on Stackoverflow
Solution 2 - AndroidDiego PalomarView Answer on Stackoverflow
Solution 3 - Androidreiti.netView Answer on Stackoverflow
Solution 4 - AndroidMaartiView Answer on Stackoverflow
Solution 5 - AndroidMichael MulaiView Answer on Stackoverflow