0
votes

I'm getting the following exception every now and again using BaseGameUtils GameHelper class from Google Play Games Services.

FATAL EXCEPTION: main
java.lang.IllegalStateException:     GameHelper: operation attempted at incorrect state. Operation: connectCurrentClient. State: DISCONNECTED. Expected state: CONNECTING.
    at com.google.example.games.basegameutils.GameHelper.assertState(GameHelper.java:184)
    at com.google.example.games.basegameutils.GameHelper.connectCurrentClient(GameHelper.java:701)
    at com.google.example.games.basegameutils.GameHelper.connectNextClient(GameHelper.java:697)
    at com.google.example.games.basegameutils.GameHelper.onConnected(GameHelper.java:777)
    at com.google.android.gms.internal.u.v(Unknown Source)
    at com.google.android.gms.internal.u$f.a(Unknown Source)
    at com.google.android.gms.internal.u$f.a(Unknown Source)
    at com.google.android.gms.internal.u$b.A(Unknown Source)
    at com.google.android.gms.internal.u$a.handleMessage(Unknown Source)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:130)
    at android.app.ActivityThread.main(ActivityThread.java:3683)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:507)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
    at dalvik.system.NativeStart.main(Native Method)

Has anyone seen this, or know how to get around it or solve it? It could be a bug.

2

2 Answers

1
votes

Make sure you have this two metadata entries in your 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.appstate.APP_ID"
    android:value="@string/app_id" />

I had only the first one and I was getting a similar error. Hope it helps.