question

kamikaze139 avatar image
kamikaze139 asked

GameCircle 2.0 crash in Unity3D

Hi, we updated the GameCircle Unity3D plugin from version 1.x to 2.0. Unfortunately, now the game crashes when calling [b]AGSAchievementsClient.ShowAchievementsOverlay (); [/b] with the following log: [i]08-09 11:55:56.612: E/AndroidRuntime(16239): FATAL EXCEPTION: GLThread 1327 08-09 11:55:56.612: E/AndroidRuntime(16239): java.lang.NullPointerException 08-09 11:55:56.612: E/AndroidRuntime(16239): at com.amazon.ags.api.unity.AchievementsClientProxyImpl.showAchievementsOverlay(AchievementsClientProxyImpl.java:79) 08-09 11:55:56.612: E/AndroidRuntime(16239): at com.unity3d.player.UnityPlayer.nativeRender(Native Method) 08-09 11:55:56.612: E/AndroidRuntime(16239): at com.unity3d.player.UnityPlayer.nativeRender(Native Method) 08-09 11:55:56.612: E/AndroidRuntime(16239): at com.unity3d.player.UnityPlayer.onDrawFrame(Unknown Source) 08-09 11:55:56.612: E/AndroidRuntime(16239): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1462) 08-09 11:55:56.612: E/AndroidRuntime(16239): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1216)[/i] Any ideas what went wrong? Thanks.
10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Sujoy@Amazon avatar image
Sujoy@Amazon answered
Hi Kamikaze139, Thank you for posting. Has the game circle is properly initialized in your app? I mean did you follow this : https://developer.amazon.com/sdk/gamecircle/documentation/unity-gamecircle-setup.html#Section7 Are you getting callback serviceReadyHandler and then calling showAchievementsOverlay() ?
10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

kamikaze139 avatar image
kamikaze139 answered
Hi Sujoy, thanks for your reply. Yes everything was initialized according to the GameCircle 2.0 Unity3D integration documentation. All additional calls are made after service ready was called back. Also, the logs seem to approve the initialization went through successfully before any other call is made. Two additional things I found out this morning: 1. The variable [i]AmazonGamesClientProxyImpl.this.agsClient[/i] inside the Unity3D GameCirlce wrapper plugin seems to be [i]null[/i] all the time. Meaning every call that is made into the GameCircle plugin (expect the initialization) throws a NullPointerException for me right now (for example requesting achievements, showing the achievements overlay, reporting achievement progress, ...) 2. Inside [i]AmazonGamesClientProxyImpl[/i] the [i]onServiceReady[/i] callback notifies Unity3D about service ready before assigning the [i]AmazonGamesClientProxyImpl.this.agsClient[/i] member variable. Calling any function inside unity when the service ready is returned might end up with a NullPointerException when accessing [i]AmazonGamesClientProxyImpl.this.agsClient[/i] due to java calls. (I am not an expert when it comes to java and unity android plugins, so this is just a guess ;) ) I hope this will help a bit investigating the problem.
10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

steve-thorne avatar image
steve-thorne answered
This is happening to me as well. Same issues. Everything is being initialized properly and I get a response from the plugin telling me that it has been initialized, but every call after that crashes the game. When it is initialized I even get the little popup telling the user that the game has been enabled for GameCircle.
10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

steve-thorne avatar image
steve-thorne answered
I am also getting this error in the editor: Exception: JNI: Init'd AndroidJavaClass with null ptr! UnityEngine.AndroidJavaClass..ctor (IntPtr jclass) (at C:/BuildAgent/work/cac08d8a5e25d4cb/Runtime/Export/AndroidJavaImpl.cs:533) UnityEngine.AndroidJavaObject.get_JavaLangClass () (at C:/BuildAgent/work/cac08d8a5e25d4cb/Runtime/Export/AndroidJavaImpl.cs:511) UnityEngine.AndroidJavaObject.FindClass (System.String name) (at C:/BuildAgent/work/cac08d8a5e25d4cb/Runtime/Export/AndroidJavaImpl.cs:502) UnityEngine.AndroidJavaClass._AndroidJavaClass (System.String className) (at C:/BuildAgent/work/cac08d8a5e25d4cb/Runtime/Export/AndroidJavaImpl.cs:522) UnityEngine.AndroidJavaClass..ctor (System.String className) (at C:/BuildAgent/work/cac08d8a5e25d4cb/Runtime/ExportGenerated/Editor/AndroidJava.cs:91) AGSClient..cctor () (at Assets/Plugins/GameCircleAndroid/AGSClient.cs:47) Rethrow as TypeInitializationException: An exception was thrown by the type initializer for AGSClient GameCircleManager.OnApplicationFocus (Boolean focusStatus) (at Assets/Plugins/GameCircleAndroid/GameCircleManager.cs:131)
10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

steve-thorne avatar image
steve-thorne answered
I've fixed the error in the editor but the game still crashes when I try to make any calls after Init
10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Sujoy@Amazon avatar image
Sujoy@Amazon answered
10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

kamikaze139 avatar image
kamikaze139 answered
Hey, just to let you know, the post from the link above solved the problem. Thanks.
10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

kamikaze139 avatar image
kamikaze139 answered
10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

jamesbigbit avatar image
jamesbigbit answered
Hi Steve How did you fix this error in the editor. I'm also getting it. Many thanks James
10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Samuel DenHartog avatar image
Samuel DenHartog answered
I'd also like to know how to solve the "Exception: JNI: Init'd AndroidJavaClass with null ptr!" error
10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.