Question

I want to learn real-time multiplayer game development using google play services.

So i just started with ButtonClicker2000 by Google to start learning multiplayer gaming for android. And below are the steps which i followed :

  • Step 1 : At directory where i keep all my eclipse projects i did

    git clone https://github.com/playgameservices/android-samples.git

  • Step 2 : updated my Google Play Services to latest version as of date June.4.2014

  • Step 3 : imported Google Play Services library project as to my workspace.

  • Step 4 : imported BaseGameUtils as library and added reference of Google Play Services to it.

All worked just great till above steps.

  • Step 5 : imported ButtonClicker2000 project from android-samples directory which i cloned from github and added BaseGameUtils library as reference to it. And it gave me compilation error for GamesClient Class which is deprecated now.

So I just Edited MainActivity.java of ButtonClicker2000 as follows:

Because GamesClient class is removed permanently, those statements

GamesClient.EXTRA_PLAYERS 
GamesClient.EXTRA_MIN_AUTOMATCH_PLAYERS 
GamesClient.EXTRA_MAX_AUTOMATCH_PLAYERS
GamesClient.EXTRA_INVITATION
GamesClient.STATUS_OK

replaced with

Games.EXTRA_PLAYERS_IDS
Multiplayer.EXTRA_MIN_AUTOMATCH_PLAYERS
Multiplayer.EXTRA_MAX_AUTOMATCH_PLAYERS
Multiplayer.EXTRA_INVITATION
GamesStatusCodes.STATUS_OK

Everything is just fine now my code is getting complied so tried with running of game on my nexus 4 device.But its crashing while launch only.

Note : I have created an app at my developer console which is unpublished and also added testing email.Also have changed my package name.I have also enabled realtime multiplayer option to yes at developer console.

LOG CAT ERROR DETAILS

06-05 17:42:37.195: W/BaseGameActivity(30121): BaseGameActivity.enabledDebugLog(bool,String) is deprecated. Use enableDebugLog(boolean)
06-05 17:42:37.195: D/GameHelper(30121): GameHelper: Debug log enabled.
06-05 17:42:37.195: D/GameHelper(30121): GameHelper: Setup: requested clients: 1
06-05 17:42:37.215: W/PopupManager(30121): You have not specified a View to use as content view for popups. Falling back to the Activity content view which may not work properly in future versions of the API. Use setViewForPopups() to set your content view.
06-05 17:42:37.275: D/dalvikvm(30121): GC_FOR_ALLOC freed 133K, 2% free 9330K/9496K, paused 16ms, total 17ms
06-05 17:42:37.305: D/GameHelper(30121): GameHelper: onStart
06-05 17:42:37.305: D/GameHelper(30121): GameHelper: Connecting client.
06-05 17:42:37.375: I/Adreno-EGL(30121): <qeglDrvAPI_eglInitialize:320>: EGL 1.4 QUALCOMM Build: I0404c4692afb8623f95c43aeb6d5e13ed4b30ddbDate: 11/06/13
06-05 17:42:37.405: D/OpenGLRenderer(30121): Enabling debug mode 0
06-05 17:42:37.405: D/AndroidRuntime(30121): Shutting down VM
06-05 17:42:37.405: W/dalvikvm(30121): threadid=1: thread exiting with uncaught exception (group=0x41573ba8)
06-05 17:42:37.415: E/AndroidRuntime(30121): FATAL EXCEPTION: main
06-05 17:42:37.415: E/AndroidRuntime(30121): Process: com.testapp.buttonclicklistnermtapp, PID: 30121
06-05 17:42:37.415: E/AndroidRuntime(30121): java.lang.IllegalStateException: A fatal developer error has occurred. Check the logs for further information.
06-05 17:42:37.415: E/AndroidRuntime(30121):    at com.google.android.gms.internal.ff$h.b(Unknown Source)
06-05 17:42:37.415: E/AndroidRuntime(30121):    at com.google.android.gms.internal.ff$h.a(Unknown Source)
06-05 17:42:37.415: E/AndroidRuntime(30121):    at com.google.android.gms.internal.ff$b.eN(Unknown Source)
06-05 17:42:37.415: E/AndroidRuntime(30121):    at com.google.android.gms.internal.ff$a.handleMessage(Unknown Source)
06-05 17:42:37.415: E/AndroidRuntime(30121):    at android.os.Handler.dispatchMessage(Handler.java:102)
06-05 17:42:37.415: E/AndroidRuntime(30121):    at android.os.Looper.loop(Looper.java:136)
06-05 17:42:37.415: E/AndroidRuntime(30121):    at android.app.ActivityThread.main(ActivityThread.java:5017)
06-05 17:42:37.415: E/AndroidRuntime(30121):    at java.lang.reflect.Method.invokeNative(Native Method)
06-05 17:42:37.415: E/AndroidRuntime(30121):    at java.lang.reflect.Method.invoke(Method.java:515)
06-05 17:42:37.415: E/AndroidRuntime(30121):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
06-05 17:42:37.415: E/AndroidRuntime(30121):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
06-05 17:42:37.415: E/AndroidRuntime(30121):    at dalvik.system.NativeStart.main(Native Method)
06-05 17:44:02.356: W/BaseGameActivity(30741): BaseGameActivity.enabledDebugLog(bool,String) is deprecated. Use enableDebugLog(boolean)
06-05 17:44:02.356: D/GameHelper(30741): GameHelper: Debug log enabled.
06-05 17:44:02.356: D/GameHelper(30741): GameHelper: Setup: requested clients: 1
06-05 17:44:02.376: W/PopupManager(30741): You have not specified a View to use as content view for popups. Falling back to the Activity content view which may not work properly in future versions of the API. Use setViewForPopups() to set your content view.
06-05 17:44:02.436: D/dalvikvm(30741): GC_FOR_ALLOC freed 125K, 2% free 9330K/9488K, paused 19ms, total 19ms
06-05 17:44:02.466: D/GameHelper(30741): GameHelper: onStart
06-05 17:44:02.466: D/GameHelper(30741): GameHelper: Connecting client.
06-05 17:44:02.556: I/Adreno-EGL(30741): <qeglDrvAPI_eglInitialize:320>: EGL 1.4 QUALCOMM Build: I0404c4692afb8623f95c43aeb6d5e13ed4b30ddbDate: 11/06/13
06-05 17:44:02.636: D/OpenGLRenderer(30741): Enabling debug mode 0
06-05 17:44:02.636: D/AndroidRuntime(30741): Shutting down VM
06-05 17:44:02.636: W/dalvikvm(30741): threadid=1: thread exiting with uncaught exception (group=0x41573ba8)
06-05 17:44:02.646: E/AndroidRuntime(30741): FATAL EXCEPTION: main
06-05 17:44:02.646: E/AndroidRuntime(30741): Process: com.testapp.buttonclicklistnermtapp, PID: 30741
06-05 17:44:02.646: E/AndroidRuntime(30741): java.lang.IllegalStateException: A fatal developer error has occurred. Check the logs for further information.
06-05 17:44:02.646: E/AndroidRuntime(30741):    at com.google.android.gms.internal.ff$h.b(Unknown Source)
06-05 17:44:02.646: E/AndroidRuntime(30741):    at com.google.android.gms.internal.ff$h.a(Unknown Source)
06-05 17:44:02.646: E/AndroidRuntime(30741):    at com.google.android.gms.internal.ff$b.eN(Unknown Source)
06-05 17:44:02.646: E/AndroidRuntime(30741):    at com.google.android.gms.internal.ff$a.handleMessage(Unknown Source)
06-05 17:44:02.646: E/AndroidRuntime(30741):    at android.os.Handler.dispatchMessage(Handler.java:102)
06-05 17:44:02.646: E/AndroidRuntime(30741):    at android.os.Looper.loop(Looper.java:136)
06-05 17:44:02.646: E/AndroidRuntime(30741):    at android.app.ActivityThread.main(ActivityThread.java:5017)
06-05 17:44:02.646: E/AndroidRuntime(30741):    at java.lang.reflect.Method.invokeNative(Native Method)
06-05 17:44:02.646: E/AndroidRuntime(30741):    at java.lang.reflect.Method.invoke(Method.java:515)
06-05 17:44:02.646: E/AndroidRuntime(30741):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
06-05 17:44:02.646: E/AndroidRuntime(30741):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
06-05 17:44:02.646: E/AndroidRuntime(30741):    at dalvik.system.NativeStart.main(Native Method)
Was it helpful?

Solution

Got the Bug I had made while updating ButtonClicker's MainActivity.java and the bug i did was to do

setRequestedClients(BaseGameActivity.CLIENT_GAMES |        
          BaseGameActivity.CLIENT_APPSTATE);

before

super.onCreate(savedInstanceState);

And rest everything is ok.

But While searching details related to realtime Multiplayer, I have found that lot of people are getting some or other problem as ButtonClicker example is not updated by Google.I hope this question will help them to get ButtonClicker2000 running successfully to understand realtime multiplayer on android with latest revision of google play services library i.e revision 17 as of now.

Its working absolutely great now !!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top