Very Close

Hey Guys,

First I just want to say thanks to everyone for making this finally happen.  The AGC plugin is exactly what I needed.  Unfortunately, I am able to crash it pretty easily.  There are 2 crashes that happen, one consistently, the other I am not able to understand yet how to reproduce.  Let’s start with the one that is easy to replicate.

What happens is if I have a scene up, and do something that will cause the AGC toast to show (unlock an achievement, sign in, etc.) then change scenes before the toast goes away, the app crashes.  The ADB logs show that the window is somehow being abandoned. I don’t know really that this is something the plugin has control over since AGC manages the toast, but perhaps an application level context (vs activity) can be used or something?  Here is a log:

10-13 23:02:27.754: W/WindowManager(575): Force-removing child win Window{42a59778 u0 SurfaceView} from container Window{42a325c0 u0 com.cluckeyetea.melodious/com.ansca.corona.CoronaActivity}

10-13 23:02:27.754: W/WindowManager(575): Failed looking up window

10-13 23:02:27.754: W/WindowManager(575): java.lang.IllegalArgumentException: Requested window android.os.BinderProxy@4291ec60 does not exist

10-13 23:02:27.754: W/WindowManager(575): at com.android.server.wm.WindowManagerService.windowForClientLocked(WindowManagerService.java:7939)

10-13 23:02:27.754: W/WindowManager(575): at com.android.server.wm.WindowManagerService.windowForClientLocked(WindowManagerService.java:7930)

10-13 23:02:27.754: W/WindowManager(575): at com.android.server.wm.WindowState$DeathRecipient.binderDied(WindowState.java:1047)

10-13 23:02:27.754: W/WindowManager(575): at android.os.BinderProxy.sendDeathNotice(Binder.java:493)

10-13 23:02:27.754: W/WindowManager(575): at dalvik.system.NativeStart.run(Native Method)

10-13 23:02:27.754: I/WindowState(575): WIN DEATH: null

10-13 23:02:27.754: I/WindowState(575): WIN DEATH: Window{4295bbb0 u0 com.cluckeyetea.melodious/com.ansca.corona.CoronaActivity}

The second error I’ve run into is a little scarier for me because when that crash occurs the plugin ceases to work until I uninstall the app and sign in again.  I’ve attached a screen shot.  The error message is: illegal state exception, HW acceleration can only be used with a single UI thread.

Keep up the progress guys.  I will post anything else I run across and hope for an update to the plugin soon.  Just FYI I won’t be available after tomorrow until probably Saturday or Sunday so if you need anything more from me make sure you hit me up tomorrow.

One more quick update, this one I am even less sure the folks at Corona have any control over since AGC is based on webviews being overlayed onto the activity (boo).  However, I note that if I unlock an achievement or update the high scores while the user is playing the game itself, the OpenGL surface skips around and stutters.  Pretty much until the toast is gone from the screen.  Just thought I’d mention it so the plugin dev could double check his/her code.  If I remember correctly the AGC call itself can happen on the bg thread while the callback always needs to run on the UI.  If this is how it is implemented and it still brings the action on the screen to a screeching halt then I guess us game devs will just have to save the achievement and leaderboard updates until the player dies and is back at the menu :frowning:

Just another item I noted. Not a big deal but currently I can’t build for iOS without commenting the AGC plugin out in my build settings file.  Would be nice if there was a way to have it just ignored so I don’t have to keep monkeying with it when I switch from iOS to Android and viceversa.  

I also get a crash when I update a high score, my app crashes.  If I send a score that is not higher than the one already out there, everything is fine.

The plugin seems to be working pretty well everywhere else… I can update achievements and scores (even with the crash), and I can get scores.  I also noticed that if I try to get a list of friend’s scores, I get global scores.

Keep up the good work!  This does look promising.

Going to amend my previous post… I am no longer getting crashes when I send or read high scores. Since I have been fiddling with my code, and it is now working, I am going to go out on a limb here and say the previous crashes were probably my fault.   :unsure:

I am still getting global scores when I call for friends scores though.  No biggie at this time.

Am curious if there has been any feedback from the plugin Dev on the crash issues? From the pro user side I feel like my options are limited. Maybe try turning off toasts and implementing my own if this the leak source but I’m not sure it is. I could also maybe move all my AGC handling to my shared module. Both are a pretty big lift on my side though so I was hoping the plugin Dev had at least double checked things on his side. One thing I thought in particular might help is wrapping his internal implementations of the lua entry points in an asynch task putting the call to agc in the doInBackground stub and then of course wrapping the callback result in a runOnUiThread. By default the thread executors will run sequentially and since there is only ever on ui thread on android it effectively enforcing one AGC call to complete before the next issues. But maybe he is already doing something similar or maybe amazon is handling all that under the covers since they don’t show anything similar in their usage examples. Hard to know exactly what is happening with no source code.

Was supposed to say there is only ever one ui thread in android. Am typing this from my phone so please forgive the typeo’s.

Can someone please give some feedback on whether or not this is being looked into? I’ve tried everything I can think of from the LUA side to keep this from happening.  There seems to be something inherently wrong with how the threads are being handled around the AGC toast messages.

10-17 22:37:10.362: W/dalvikvm(1600): threadid=10: thread exiting with uncaught exception (group=0x41d0cba8)

10-17 22:37:10.362: E/AndroidRuntime(1600): FATAL EXCEPTION: GLThread 2865

10-17 22:37:10.362: E/AndroidRuntime(1600): Process: com.cluckeyetea.melodious, PID: 1600

10-17 22:37:10.362: E/AndroidRuntime(1600): java.lang.IllegalStateException: Hardware acceleration can only be used with a single UI thread.

10-17 22:37:10.362: E/AndroidRuntime(1600): Original thread: Thread[main,5,main]

10-17 22:37:10.362: E/AndroidRuntime(1600): Current thread: Thread[GLThread 2865,5,main]

10-17 22:37:10.362: E/AndroidRuntime(1600): at android.view.HardwareRenderer$GlRenderer.checkRenderContext(HardwareRenderer.java:1746)

10-17 22:37:10.362: E/AndroidRuntime(1600): at android.view.HardwareRenderer$Gl20Renderer.safelyRun(HardwareRenderer.java:2226)

10-17 22:37:10.362: E/AndroidRuntime(1600): at android.view.HardwareRenderer$Gl20Renderer.destroyHardwareResources(HardwareRenderer.java:2279)

10-17 22:37:10.362: E/AndroidRuntime(1600): at android.view.ViewRootImpl.destroyHardwareRenderer(ViewRootImpl.java:5344)

10-17 22:37:10.362: E/AndroidRuntime(1600): at android.view.ViewRootImpl.die(ViewRootImpl.java:5253)

10-17 22:37:10.362: E/AndroidRuntime(1600): at android.view.WindowManagerGlobal.removeViewLocked(WindowManagerGlobal.java:346)

10-17 22:37:10.362: E/AndroidRuntime(1600): at android.view.WindowManagerGlobal.removeView(WindowManagerGlobal.java:301)

10-17 22:37:10.362: E/AndroidRuntime(1600): at android.view.WindowManagerImpl.removeView(WindowManagerImpl.java:79)

10-17 22:37:10.362: E/AndroidRuntime(1600): at com.amazon.ags.html5.overlay.toasts.ClickableToastImpl.dismiss(ClickableToastImpl.java:290)

10-17 22:37:10.362: E/AndroidRuntime(1600): at com.amazon.ags.html5.overlay.toasts.ClickableToastFactoryImpl.dismissCurrentToast(ClickableToastFactoryImpl.java:166)

10-17 22:37:10.362: E/AndroidRuntime(1600): at com.amazon.ags.html5.factory.ServiceFactory.onPause(ServiceFactory.java:403)

10-17 22:37:10.362: E/AndroidRuntime(1600): at com.amazon.ags.api.AmazonGamesClient.release_internal(AmazonGamesClient.java:535)

10-17 22:37:10.362: E/AndroidRuntime(1600): at com.amazon.ags.api.AmazonGamesClient.release(AmazonGamesClient.java:516)

10-17 22:37:10.362: E/AndroidRuntime(1600): at plugin.gamecircle.LuaLoader.ReleaseGameCircleFeatures(LuaLoader.java:128)

10-17 22:37:10.362: E/AndroidRuntime(1600): at plugin.gamecircle.LuaLoader.onSuspended(LuaLoader.java:1898)

10-17 22:37:10.362: E/AndroidRuntime(1600): at com.ansca.corona.CoronaEnvironment$RuntimeEventHandler.onSuspended(CoronaEnvironment.java:446)

10-17 22:37:10.362: E/AndroidRuntime(1600): at com.ansca.corona.CoronaRuntime.onSuspended(CoronaRuntime.java:382)

10-17 22:37:10.362: E/AndroidRuntime(1600): at com.ansca.corona.NativeToJavaBridge.callOnRuntimeSuspended(NativeToJavaBridge.java:417)

10-17 22:37:10.362: E/AndroidRuntime(1600): at com.ansca.corona.JavaToNativeShim.nativePause(Native Method)

10-17 22:37:10.362: E/AndroidRuntime(1600): at com.ansca.corona.JavaToNativeShim.pause(JavaToNativeShim.java:134)

10-17 22:37:10.362: E/AndroidRuntime(1600): at com.ansca.corona.Controller.updateRuntimeState(Controller.java:286)

10-17 22:37:10.362: E/AndroidRuntime(1600): at com.ansca.corona.graphics.opengl.CoronaGLSurfaceView$CoronaRenderer.onDrawFrame(CoronaGLSurfaceView.java:417)

10-17 22:37:10.362: E/AndroidRuntime(1600): at com.ansca.corona.graphics.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1622)

10-17 22:37:10.362: E/AndroidRuntime(1600): at com.ansca.corona.graphics.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1377)

Hey Good news! I don’t know if you guys have made an update to the plugin or not but suddenly it seems to be working.  A change I made locally was updating my scene management from Storyboard to Composer.  So at this point I don’t really know why it wasn’t working before, I can only confirm that I am no longer crashing.

The Game Circle plugin was working for us until just shortly (not sure exactly when it stopped). Now as soon as the plugin is required I get this error:

Runtime error error loading module 'plugin\_gamecircle' from file '/Users/alan/Library/Application Support/Corona/Simulator/Plugins/plugin\_gamecircle.lua': /Users/alan/Library/Application Support/Corona/Simulator/Plugins/plugin\_gamecircle.lua:93: 'end' expected (to close 'function' at line 89) near '=' stack traceback: [C]: ? [C]: in function 'require' ?: in function 'require' /Users/alan/QuizTix/main.lua:3247: in function \</Users/alan/QuizTix/main.lua:3228\> ?: in function \<?:221\>

I presume a change has been pushed with a typo in it or something, is it possible to have this fixed asap? We were planning on submitting an update to Amazon today, but this is holding us back.

Thanks

In fact, if I look at the plugin code in my library folder, I can see there are 2 errors in it:

  1. As the error message suggests, the “end” is missing from the GetLocalPlayerSpoof function.

  2. lib.WhisperSync.DecrementAccumulatingNumber has a typo - the upper case “S” in WhisperSync should be a lower case “s”

Fixing both of these allows the simulator to function as normal. Would advise the plugin developer fixes them, and double checks there are no similar typos in the real plugin lib.

One more quick update, this one I am even less sure the folks at Corona have any control over since AGC is based on webviews being overlayed onto the activity (boo).  However, I note that if I unlock an achievement or update the high scores while the user is playing the game itself, the OpenGL surface skips around and stutters.  Pretty much until the toast is gone from the screen.  Just thought I’d mention it so the plugin dev could double check his/her code.  If I remember correctly the AGC call itself can happen on the bg thread while the callback always needs to run on the UI.  If this is how it is implemented and it still brings the action on the screen to a screeching halt then I guess us game devs will just have to save the achievement and leaderboard updates until the player dies and is back at the menu :frowning:

Just another item I noted. Not a big deal but currently I can’t build for iOS without commenting the AGC plugin out in my build settings file.  Would be nice if there was a way to have it just ignored so I don’t have to keep monkeying with it when I switch from iOS to Android and viceversa.  

I also get a crash when I update a high score, my app crashes.  If I send a score that is not higher than the one already out there, everything is fine.

The plugin seems to be working pretty well everywhere else… I can update achievements and scores (even with the crash), and I can get scores.  I also noticed that if I try to get a list of friend’s scores, I get global scores.

Keep up the good work!  This does look promising.

Going to amend my previous post… I am no longer getting crashes when I send or read high scores. Since I have been fiddling with my code, and it is now working, I am going to go out on a limb here and say the previous crashes were probably my fault.   :unsure:

I am still getting global scores when I call for friends scores though.  No biggie at this time.

Am curious if there has been any feedback from the plugin Dev on the crash issues? From the pro user side I feel like my options are limited. Maybe try turning off toasts and implementing my own if this the leak source but I’m not sure it is. I could also maybe move all my AGC handling to my shared module. Both are a pretty big lift on my side though so I was hoping the plugin Dev had at least double checked things on his side. One thing I thought in particular might help is wrapping his internal implementations of the lua entry points in an asynch task putting the call to agc in the doInBackground stub and then of course wrapping the callback result in a runOnUiThread. By default the thread executors will run sequentially and since there is only ever on ui thread on android it effectively enforcing one AGC call to complete before the next issues. But maybe he is already doing something similar or maybe amazon is handling all that under the covers since they don’t show anything similar in their usage examples. Hard to know exactly what is happening with no source code.

Was supposed to say there is only ever one ui thread in android. Am typing this from my phone so please forgive the typeo’s.

Can someone please give some feedback on whether or not this is being looked into? I’ve tried everything I can think of from the LUA side to keep this from happening.  There seems to be something inherently wrong with how the threads are being handled around the AGC toast messages.

10-17 22:37:10.362: W/dalvikvm(1600): threadid=10: thread exiting with uncaught exception (group=0x41d0cba8)

10-17 22:37:10.362: E/AndroidRuntime(1600): FATAL EXCEPTION: GLThread 2865

10-17 22:37:10.362: E/AndroidRuntime(1600): Process: com.cluckeyetea.melodious, PID: 1600

10-17 22:37:10.362: E/AndroidRuntime(1600): java.lang.IllegalStateException: Hardware acceleration can only be used with a single UI thread.

10-17 22:37:10.362: E/AndroidRuntime(1600): Original thread: Thread[main,5,main]

10-17 22:37:10.362: E/AndroidRuntime(1600): Current thread: Thread[GLThread 2865,5,main]

10-17 22:37:10.362: E/AndroidRuntime(1600): at android.view.HardwareRenderer$GlRenderer.checkRenderContext(HardwareRenderer.java:1746)

10-17 22:37:10.362: E/AndroidRuntime(1600): at android.view.HardwareRenderer$Gl20Renderer.safelyRun(HardwareRenderer.java:2226)

10-17 22:37:10.362: E/AndroidRuntime(1600): at android.view.HardwareRenderer$Gl20Renderer.destroyHardwareResources(HardwareRenderer.java:2279)

10-17 22:37:10.362: E/AndroidRuntime(1600): at android.view.ViewRootImpl.destroyHardwareRenderer(ViewRootImpl.java:5344)

10-17 22:37:10.362: E/AndroidRuntime(1600): at android.view.ViewRootImpl.die(ViewRootImpl.java:5253)

10-17 22:37:10.362: E/AndroidRuntime(1600): at android.view.WindowManagerGlobal.removeViewLocked(WindowManagerGlobal.java:346)

10-17 22:37:10.362: E/AndroidRuntime(1600): at android.view.WindowManagerGlobal.removeView(WindowManagerGlobal.java:301)

10-17 22:37:10.362: E/AndroidRuntime(1600): at android.view.WindowManagerImpl.removeView(WindowManagerImpl.java:79)

10-17 22:37:10.362: E/AndroidRuntime(1600): at com.amazon.ags.html5.overlay.toasts.ClickableToastImpl.dismiss(ClickableToastImpl.java:290)

10-17 22:37:10.362: E/AndroidRuntime(1600): at com.amazon.ags.html5.overlay.toasts.ClickableToastFactoryImpl.dismissCurrentToast(ClickableToastFactoryImpl.java:166)

10-17 22:37:10.362: E/AndroidRuntime(1600): at com.amazon.ags.html5.factory.ServiceFactory.onPause(ServiceFactory.java:403)

10-17 22:37:10.362: E/AndroidRuntime(1600): at com.amazon.ags.api.AmazonGamesClient.release_internal(AmazonGamesClient.java:535)

10-17 22:37:10.362: E/AndroidRuntime(1600): at com.amazon.ags.api.AmazonGamesClient.release(AmazonGamesClient.java:516)

10-17 22:37:10.362: E/AndroidRuntime(1600): at plugin.gamecircle.LuaLoader.ReleaseGameCircleFeatures(LuaLoader.java:128)

10-17 22:37:10.362: E/AndroidRuntime(1600): at plugin.gamecircle.LuaLoader.onSuspended(LuaLoader.java:1898)

10-17 22:37:10.362: E/AndroidRuntime(1600): at com.ansca.corona.CoronaEnvironment$RuntimeEventHandler.onSuspended(CoronaEnvironment.java:446)

10-17 22:37:10.362: E/AndroidRuntime(1600): at com.ansca.corona.CoronaRuntime.onSuspended(CoronaRuntime.java:382)

10-17 22:37:10.362: E/AndroidRuntime(1600): at com.ansca.corona.NativeToJavaBridge.callOnRuntimeSuspended(NativeToJavaBridge.java:417)

10-17 22:37:10.362: E/AndroidRuntime(1600): at com.ansca.corona.JavaToNativeShim.nativePause(Native Method)

10-17 22:37:10.362: E/AndroidRuntime(1600): at com.ansca.corona.JavaToNativeShim.pause(JavaToNativeShim.java:134)

10-17 22:37:10.362: E/AndroidRuntime(1600): at com.ansca.corona.Controller.updateRuntimeState(Controller.java:286)

10-17 22:37:10.362: E/AndroidRuntime(1600): at com.ansca.corona.graphics.opengl.CoronaGLSurfaceView$CoronaRenderer.onDrawFrame(CoronaGLSurfaceView.java:417)

10-17 22:37:10.362: E/AndroidRuntime(1600): at com.ansca.corona.graphics.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1622)

10-17 22:37:10.362: E/AndroidRuntime(1600): at com.ansca.corona.graphics.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1377)

Hey Good news! I don’t know if you guys have made an update to the plugin or not but suddenly it seems to be working.  A change I made locally was updating my scene management from Storyboard to Composer.  So at this point I don’t really know why it wasn’t working before, I can only confirm that I am no longer crashing.

The Game Circle plugin was working for us until just shortly (not sure exactly when it stopped). Now as soon as the plugin is required I get this error:

Runtime error error loading module 'plugin\_gamecircle' from file '/Users/alan/Library/Application Support/Corona/Simulator/Plugins/plugin\_gamecircle.lua': /Users/alan/Library/Application Support/Corona/Simulator/Plugins/plugin\_gamecircle.lua:93: 'end' expected (to close 'function' at line 89) near '=' stack traceback: [C]: ? [C]: in function 'require' ?: in function 'require' /Users/alan/QuizTix/main.lua:3247: in function \</Users/alan/QuizTix/main.lua:3228\> ?: in function \<?:221\>

I presume a change has been pushed with a typo in it or something, is it possible to have this fixed asap? We were planning on submitting an update to Amazon today, but this is holding us back.

Thanks