Android Game Services always crashes on Nexus 7

There are no other apps running, I cleared the app cache and data, and yes my google account is setup with google+ and is setup as a developer for the app.

Could it possible be that I got the wrong number for the App ID? Or would that just show an error later on?

The id is displayed on the right site in the google play service site. At the position 5 (test) clear your account name, save the settings and enter the e mail again.

I’m pretty sure I have the right ID now and I cleared the emails but it still crashes :frowning:

YEEESS!!! I finally figured it out!! I stupidly added the googlePlayGamesAppId (build.settings) into the usesPermissions table instead of just the android table. Here is my new android table in my build.settings:

[lua]

    android = 

    {

        googlePlayGamesAppId = “182739516720”,

        usesPermissions =

        {

            “android.permission.INTERNET”, 

        }

    },

[/lua]

Thank you everyone for your help!

Hey, @AppdojoStudios, I wonder why you are having trouble with leaderboards.  I’ve implemented it, and I haven’t seen mine crash on Nexus 7.  I’m assuming you are talking about Google Play game services – if not, you might want to elaborate a little more about which leadearboard and what tutorial, and other relevant details?

Naomi

Hi Naomi,

I am trying to follow this tutorial on using Google Play Game Services: http://www.coronalabs.com/blog/2013/06/25/tutorial-introducing-google-play-game-services/

I did the “Build.settings” part and am now on the “Login and Event Handlers” part. Whenever I put that code in my game (minus the saveSettings function)  it just crashes. I’ve try’d commenting portions out to narrow down the problem but it seems like its the whole thing that’s messing it up. 

You said that you’ve implemented and tested leader boards with a Nexus 7. Do you think you could post the code you used?

Thanks for the help!

-Zac

@AppdojoStudios, are there any errors in your console log?  If you don’t know how to get them please see this blog post:

http://www.coronalabs.com/blog/2013/07/09/tutorial-basic-debugging/

If you’re crashing, there should be messages in the log file that tells you why.  We can only guess at what your problem might be without this and without seeing your code.

Here is the code that I add that causes it to crash:

[lua]

    local gameNetwork = require( “gameNetwork” )

    local playerName

    local function loadLocalPlayerCallback( event )

       playerName = event.data.alias

       saveSettings()  --save player data locally using your own “saveSettings()” function

    end

    local function gameNetworkLoginCallback( event )

       gameNetwork.request( “loadLocalPlayer”, { listener=loadLocalPlayerCallback } )

       return true

    end

    local function gpgsInitCallback( event )

       gameNetwork.request( “login”, { userInitiated=true, listener=gameNetworkLoginCallback } )

    end

    local function gameNetworkSetup()

       if ( system.getInfo(“platformName”) == “Android” ) then

          gameNetwork.init( “google”, gpgsInitCallback )

       else

          gameNetwork.init( “gamecenter”, gameNetworkLoginCallback )

       end

    end

    ------HANDLE SYSTEM EVENTS------

    local function systemEvents( event )

       print("systemEvent " … event.type)

       if ( event.type == “applicationSuspend” ) then

          print( “suspending…” )

       elseif ( event.type == “applicationResume” ) then

          print( “resuming…” )

       elseif ( event.type == “applicationExit” ) then

          print( “exiting…” )

       elseif ( event.type == “applicationStart” ) then

          gameNetworkSetup()  --login to the network here

       end

       return true

    end

    Runtime:addEventListener( “system”, systemEvents )

[/lua]

And here is the log i get when using ADB ("./adb logcat Corona:v *:s"):

I/Corona  (15624): systemEvent applicationStart

V/Corona  (15624): > Class.forName: CoronaProvider.gameNetwork.google.LuaLoader

V/Corona  (15624): < Class.forName: CoronaProvider.gameNetwork.google.LuaLoader

V/Corona  (15624): Loading via reflection: CoronaProvider.gameNetwork.google.LuaLoader

V/Corona  (10774): InMobi ad request failed

I’m not using inMobi so I don’t know what’s up with that, but here is the log I get when just using ./adb logcat: 

V/Corona  (15832): Loading via reflection: CoronaProvider.gameNetwork.google.LuaLoader

W/dalvikvm(15832): VFY: unable to resolve static field 3387 (common_google_play_services_install_title) in Lcom/google/android/gms/R$string;

D/dalvikvm(15832): VFY: replacing opcode 0x60 at 0x0041

W/dalvikvm(15832): VFY: unable to resolve static field 3383 (common_google_play_services_enable_title) in Lcom/google/android/gms/R$string;

D/dalvikvm(15832): VFY: replacing opcode 0x60 at 0x004c

W/dalvikvm(15832): VFY: unable to resolve static field 3393 (common_google_play_services_update_title) in Lcom/google/android/gms/R$string;

D/dalvikvm(15832): VFY: replacing opcode 0x60 at 0x0057

W/dalvikvm(15832): VFY: unable to resolve static field 3390 (common_google_play_services_unsupported_title) in Lcom/google/android/gms/R$string;

D/dalvikvm(15832): VFY: replacing opcode 0x60 at 0x0069

W/dalvikvm(15832): VFY: unable to resolve static field 3384 (common_google_play_services_install_button) in Lcom/google/android/gms/R$string;

D/dalvikvm(15832): VFY: replacing opcode 0x60 at 0x0009

W/dalvikvm(15832): VFY: unable to resolve static field 3381 (common_google_play_services_enable_button) in Lcom/google/android/gms/R$string;

D/dalvikvm(15832): VFY: replacing opcode 0x60 at 0x0010

W/dalvikvm(15832): VFY: unable to resolve static field 3391 (common_google_play_services_update_button) in Lcom/google/android/gms/R$string;

D/dalvikvm(15832): VFY: replacing opcode 0x60 at 0x0017

W/dalvikvm(15832): VFY: unable to resolve static field 3388 (common_google_play_services_unknown_issue) in Lcom/google/android/gms/R$string;

D/dalvikvm(15832): VFY: replacing opcode 0x60 at 0x0004

I/dalvikvm(15832): DexOpt: unable to optimize static field ref 0x0d3a at 0x18 in Lcom/google/android/gms/common/GooglePlayServicesUtil;.b

I/dalvikvm(15832): DexOpt: unable to optimize static field ref 0x0d39 at 0x38 in Lcom/google/android/gms/common/GooglePlayServicesUtil;.b

I/dalvikvm(15832): DexOpt: unable to optimize static field ref 0x0d36 at 0x3f in Lcom/google/android/gms/common/GooglePlayServicesUtil;.b

I/dalvikvm(15832): DexOpt: unable to optimize static field ref 0x0d40 at 0x46 in Lcom/google/android/gms/common/GooglePlayServicesUtil;.b

I/dalvikvm(15832): DexOpt: unable to optimize static field ref 0x0d3d at 0x66 in Lcom/google/android/gms/common/GooglePlayServicesUtil;.b

W/GooglePlayServicesUtil(15832): Google Play services out of date.  Requires 3136100 but found 2012110

D/BaseGameActivity(15832): onCreate: creating GamesClient

D/BaseGameActivity(15832): onCreate: creating GamesPlusClient

W/GooglePlayServicesUtil(15832): Google Play services out of date.  Requires 3136100 but found 2012110

D/BaseGameActivity(15832): isGooglePlayServicesAvailable returned 2

D/BaseGameActivity(15832): Google Play services not available. Show error dialog.

D/AndroidRuntime(15832): Shutting down VM

W/dalvikvm(15832): threadid=1: thread exiting with uncaught exception (group=0x40f2a930)

E/AndroidRuntime(15832): FATAL EXCEPTION: main

E/AndroidRuntime(15832): java.lang.NullPointerException

E/AndroidRuntime(15832):     at CoronaProvider.gameNetwork.google.GameHelper.getErrorDialog(GameHelper.java:483)

E/AndroidRuntime(15832):     at CoronaProvider.gameNetwork.google.GameHelper.beginUserInitiatedSignIn(GameHelper.java:426)

E/AndroidRuntime(15832):     at CoronaProvider.gameNetwork.google.LuaLoader$3.run(LuaLoader.java:192)

E/AndroidRuntime(15832):     at android.os.Handler.handleCallback(Handler.java:725)

E/AndroidRuntime(15832):     at android.os.Handler.dispatchMessage(Handler.java:92)

E/AndroidRuntime(15832):     at android.os.Looper.loop(Looper.java:137)

E/AndroidRuntime(15832):     at android.app.ActivityThread.main(ActivityThread.java:5041)

E/AndroidRuntime(15832):     at java.lang.reflect.Method.invokeNative(Native Method)

E/AndroidRuntime(15832):     at java.lang.reflect.Method.invoke(Method.java:511)

E/AndroidRuntime(15832):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)

E/AndroidRuntime(15832):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)

E/AndroidRuntime(15832):     at dalvik.system.NativeStart.main(Native Method)

W/ActivityManager(  475):   Force finishing activity com.appdojo.lettercraft/com.ansca.corona.CoronaActivity

D/dalvikvm(  475): GC_FOR_ALLOC freed 715K, 22% free 17449K/22216K, paused 61ms, total 63ms

V/InmobiAndroidSDK2.3(10774): Your request cannot be processed at this time.Please try again later

V/Corona  (10774): InMobi ad request failed

W/ActivityManager(  475): Activity pause timeout for ActivityRecord{41a01a98 u0 com.appdojo.lettercraft/com.ansca.corona.CoronaActivity}

I/Process (15832): Sending signal. PID: 15832 SIG: 9

I/WindowState(  475): WIN DEATH: Window{42089d00 u0 com.appdojo.lettercraft/com.ansca.corona.CoronaActivity}

W/WindowManager(  475): Force-removing child win Window{4216e068 u0 SurfaceView} from container Window{42089d00 u0 com.appdojo.lettercraft/com.ansca.corona.CoronaActivity}

I/ActivityManager(  475): Process com.appdojo.lettercraft (pid 15832) has died.

W/WindowManager(  475): Failed looking up window

W/WindowManager(  475): java.lang.IllegalArgumentException: Requested window android.os.BinderProxy@4169a758 does not exist

W/WindowManager(  475):     at com.android.server.wm.WindowManagerService.windowForClientLocked(WindowManagerService.java:8102)

W/WindowManager(  475):     at com.android.server.wm.WindowManagerService.windowForClientLocked(WindowManagerService.java:8093)

W/WindowManager(  475):     at com.android.server.wm.WindowState$DeathRecipient.binderDied(WindowState.java:932)

W/WindowManager(  475):     at android.os.BinderProxy.sendDeathNotice(Binder.java:433)

W/WindowManager(  475):     at dalvik.system.NativeStart.run(Native Method)

I/WindowState(  475): WIN DEATH: null

W/InputMethodManagerService(  475): Got RemoteException sending setActive(false) notification to pid 15832 uid 10067

Sorry about the length, I’m not sure how to tell what parts are relevant :( and I bolded the text in-between logs just for visibility. It looks like the Google Play Services are out of date? How would I update them?

EDIT: I updated Corona and that didn’t do anything.

I suspect the “out of date” is a red herring.  This is new, and we are using the latest.  I suspect that you’ve got some setup issue.  Can you post your build.settings and config.lua?  Are you sure your SHA1 key is correct?

Where do I enter the SHA1 key into Corona?

Here’s my Config:
[lua]

application = {
content = {
width = 640,
height = 960, --1136
scale = “zoomstretch”,
fps = 60,
launchpad = false,
},
}
[/lua]

Here’s my Build.settings, sorry about how messy it is:

[lua]

– Supported values for orientation:
– portrait, portraitUpsideDown, landscapeLeft, landscapeRight

settings = {

orientation = {
default = “portrait”,
supported = { “portrait”, }
},

iphone = {
plist = {
UIStatusBarHidden = true,
UIPrerenderedIcon = true, – set to false for “shine” overlay
–UIApplicationExitsOnSuspend = true, – uncomment to quit app on suspend
UIAppFonts =
{
“Hiruko.otf”
}

–[[
– iOS app URL schemes:
CFBundleURLTypes =
{
{
CFBundleURLSchemes =
{
“fbXXXXXXXXXXXXXX”, – example scheme for facebook
“coronasdkapp”, – example second scheme
}
}
}
–]]
},
components = {

}
},

android =
{
usesPermissions =
{
“android.permission.INTERNET”,
googlePlayGamesAppId = “182739516720”
}

},

plugins =
{
–key is the name passed to the Lua “require()”
[“CoronaProvider.gameNetwork.google”] =
{
–required!
publisherId = “com.coronalabs”,
},
},
}
[/lua]

I think I might have the wrong App ID because I did have some trouble finding it, I might have the wrong number. How do I find it in the google play dev console?

Hi AppdojoStudios

Please read the documentation there are some additional information’s about the Google Play Game Service and the error
handling. I had with the first release also some problems but after Integration of the error handling in my code it works fine. Important the user must have his google+ account extend with the GPGS, I ask the users always on the first
lunch of the app if he like to use the GPGS and if they have a goole+ account which can be used for the service.

 

http://docs.coronalabs.com/plugin/gameNetwork-google/init.html

BR

Michael

 

Thanks for showing me the error handling! I implemented that and simplified my code and this is what it is now:

[lua]

    local function gameNetworkLoginCallback( event )

        --nothing here just for testing

    end

    local function gpgsInitCallback( event )

        print(event.isError, “#######EVENTERROR######”)

        if event.isError == nil then

            print(“Initialize GPGS”)

            loggedIntoGC = true

               gameNetwork.request( “login”, { userInitiated=true, listener=gameNetworkLoginCallback } )

        elseif event.isError == true then

            print(event.errorMessage, “############ERROR###########”)

        end

    end

    gameNetwork.init( “google”, gpgsInitCallback )

[/lua]

So in the console (on device) it prints event.isError as “nil” so it seems like thats working and then it crashes on the login. 

go to the android Settings Screen, Application, select your application, stop the application and clean Cache and app data. check if there other apps running they like to use the same function.

Michael

did you Register the user for testing in the Google Play Service for your app?

There are no other apps running, I cleared the app cache and data, and yes my google account is setup with google+ and is setup as a developer for the app.

Could it possible be that I got the wrong number for the App ID? Or would that just show an error later on?

The id is displayed on the right site in the google play service site. At the position 5 (test) clear your account name, save the settings and enter the e mail again.

I’m pretty sure I have the right ID now and I cleared the emails but it still crashes :frowning:

YEEESS!!! I finally figured it out!! I stupidly added the googlePlayGamesAppId (build.settings) into the usesPermissions table instead of just the android table. Here is my new android table in my build.settings:

[lua]

    android = 

    {

        googlePlayGamesAppId = “182739516720”,

        usesPermissions =

        {

            “android.permission.INTERNET”, 

        }

    },

[/lua]

Thank you everyone for your help!

Muhuhahhaa!!! Thank you soooo muchh!! I had a similar problem! I followed the tutorial and finally found my error:

WRONG WAY -->

android = { usesPermissions = { "android.permission.INTERNET", -- Required for Inneractive "android.permission.ACCESS\_NETWORK\_STATE", -- Required for Inneractive "android.permission.READ\_PHONE\_STATE", -- Required for Inneractive "com.android.vending.BILLING", -- Required for In App Purchases }, { googlePlayGamesAppId = "123456789" -- Required for GPGS, Google Play Games App Id }, },

CORRECT WAY -->
 

android = { usesPermissions = { "android.permission.INTERNET", -- Required for Inneractive "android.permission.ACCESS\_NETWORK\_STATE", -- Required for Inneractive "android.permission.READ\_PHONE\_STATE", -- Required for Inneractive "com.android.vending.BILLING", -- Required for In App Purchases }, googlePlayGamesAppId = "123456789" -- Required for GPGS, Google Play Games App Id },

Muhuhahhaa!!! Thank you soooo muchh!! I had a similar problem! I followed the tutorial and finally found my error:

WRONG WAY -->

android = { usesPermissions = { "android.permission.INTERNET", -- Required for Inneractive "android.permission.ACCESS\_NETWORK\_STATE", -- Required for Inneractive "android.permission.READ\_PHONE\_STATE", -- Required for Inneractive "com.android.vending.BILLING", -- Required for In App Purchases }, { googlePlayGamesAppId = "123456789" -- Required for GPGS, Google Play Games App Id }, },

CORRECT WAY -->
 

android = { usesPermissions = { "android.permission.INTERNET", -- Required for Inneractive "android.permission.ACCESS\_NETWORK\_STATE", -- Required for Inneractive "android.permission.READ\_PHONE\_STATE", -- Required for Inneractive "com.android.vending.BILLING", -- Required for In App Purchases }, googlePlayGamesAppId = "123456789" -- Required for GPGS, Google Play Games App Id },