69

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

FoamyGuy
  • 45,328
  • 16
  • 118
  • 151
Semanticer
  • 1,823
  • 1
  • 16
  • 26

5 Answers5

127

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

Oss
  • 4,052
  • 2
  • 18
  • 35
Hetabiquo
  • 1,286
  • 1
  • 9
  • 3
  • 8
    facepalm - I had it in `AndroidManifest.xml` but not on my `` tag. thanks – Semanticer May 17 '13 at 09:19
  • 5
    Slight addition, do not replace ".APP_ID" with your APP ID from the developer console. I lost about 15 minutes with that :| – RelativeGames May 24 '13 at 06:03
  • 34
    Another addition, do not put your app ID directly to the meta-data tag. It is resolved as integer when the system expects it to be a String :| – Finnboy11 Jun 28 '13 at 15:13
  • 4
    Another addition, by "unfiltered logs" it means checking the full device logs instead of your application-specific onces. Google Play Services is not part of your app so it's error messages aren't logged there. – you786 Oct 17 '13 at 18:45
  • Sorry, if this is a dumb question, but what to type as APP_ID there? I'm very new to Android developing. – d0n.key Oct 31 '15 at 14:55
  • One more thing, here is how to find your APP_ID : http://stackoverflow.com/questions/22363139/how-to-get-android-app-id-from-google-play-services – Maarti Jan 26 '16 at 22:28
18

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" />
Diego Palomar
  • 6,707
  • 1
  • 26
  • 37
2

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.

reiti.net
  • 315
  • 1
  • 12
1

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

**Games Services** tab

Maarti
  • 3,014
  • 4
  • 14
  • 31
0

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!