question

dantreble avatar image
dantreble asked

null pointer exception calling AGSProfilesClient.RequestLocalPlayerProfile

What is the best way of getting a null pointer exception calling AGSProfilesClient.RequestLocalPlayerProfile(); ? I wait for AGSClient.ServiceReadyEvent to come back, then call AGSProfilesClient.RequestLocalPlayerProfile() Be awesome if you could check your nulls, then I might have an error message or something crazy like that! I/Unity (27372): AmazonGameCircle: Client GameCircle - Service is ready I/Unity (27372): I/Unity (27372): (Filename: ./Runtime/ExportGenerated/AndroidManaged/UnityEngineDebug.cpp Line: 54) I/Unity (27372): I/Unity (27372): ServiceReadyHandler I/Unity (27372): I/Unity (27372): (Filename: ./Runtime/ExportGenerated/AndroidManaged/UnityEngineDebug.cpp Line: 54) I/Unity (27372): I/Unity (27372): OnSdkAvailable. isTestMode: True I/Unity (27372): I/Unity (27372): (Filename: ./Runtime/ExportGenerated/AndroidManaged/UnityEngineDebug.cpp Line: 54) I/Unity (27372): W/GC_AsynchronousReplyMessenger(27372): Request af9d60ee-ea08-404b-be2a-1c0de82768d9 timed out. D/AndroidRuntime(27372): Shutting down VM W/dalvikvm(27372): threadid=1: thread exiting with uncaught exception (group=0x40c06ac8) E/AndroidRuntime(27372): FATAL EXCEPTION: main E/AndroidRuntime(27372): java.lang.Error: FATAL EXCEPTION [main] E/AndroidRuntime(27372): Unity version : 4.2.2f1 E/AndroidRuntime(27372): Device model : Amazon KFTHWI E/AndroidRuntime(27372): Device fingerprint: Amazon/thor/thor:4.2.2/JDQ39/13.3.1.0_user_310079820:user/release-keys E/AndroidRuntime(27372): E/AndroidRuntime(27372): Caused by: java.lang.NullPointerException E/AndroidRuntime(27372): at com.amazon.ags.api.unity.ProfilesClientProxyImpl$1.run(ProfilesClientProxyImpl.java:40) E/AndroidRuntime(27372): at android.os.Handler.handleCallback(Handler.java:747) E/AndroidRuntime(27372): at android.os.Handler.dispatchMessage(Handler.java:92) E/AndroidRuntime(27372): at android.os.Looper.loop(Looper.java:151) E/AndroidRuntime(27372): at android.app.ActivityThread.main(ActivityThread.java:5185) E/AndroidRuntime(27372): at java.lang.reflect.Method.invokeNative(Native Method) E/AndroidRuntime(27372): at java.lang.reflect.Method.invoke(Method.java:511) E/AndroidRuntime(27372): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) E/AndroidRuntime(27372): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) E/AndroidRuntime(27372): at dalvik.system.NativeStart.main(Native Method)
10 |5000

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

dantreble avatar image
dantreble answered
I think I have it worked out. The static constructor: static AGSProfilesClient(){ Runs before I have called AGSClient.Init The "getInstance" in the static constructor AGSProfilesClient() in java will create a new ProfilesClientProxyImp public static ProfilesClientProxy getInstance() { if (instance == null) { instance = new ProfilesClientProxyImpl(); } return instance; } The base class UnityClientProxyBase will try and get an instance for the amazon games client this.agsClient = ((AmazonGamesClient)AmazonGamesClient.getInstance()); but that will fail, as no one has created a Amazon games client yet public static AmazonGames getInstance() { AmazonGames instance = INSTANCE; if (INSTANCE == null) { Log.w("GameCircleClient", "AmazonGamesClient is not initialized. Please call AmazonGamesClient.initialize() first."); } Now my java class ProfilesClientProxy has a null ags member. I don't know yet how I'm going to fix this mess, or ever get thee days of my life back :-( TL:DR Requiring order in static constructor calls in c# is dangerous http://msdn.microsoft.com/en-us/library/k9x6w0hc.aspx "The user has no control on when the static constructor is executed in the program."
10 |5000

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 Dantreble, Thank you for writing to us. Can you please confirm what version of SDK you are using? Can you please use the latest SDK and see whether you have the same issue or not?
10 |5000

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

dantreble avatar image
dantreble answered
Sujoy, I just laid it all out for you, found the problem and your response is "did you turn it off and on again". I am using version Amazon GameCircle Unity Plugin Version 2.3.0 Amazon GameCircle Android SDK Version 2.2.1 Amazon GameCircle iOS SDK Version 3.1.1 Amazon Insights Android SDK Version 2.1.16 Amazon Insights iOS SDK Version 2.1.11.0 of your buggy plugin
10 |5000

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 Dantreble, This issue is forwarded to the concerned team and they are looking into it. I will post updates.
10 |5000

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 Dantreble, We are sorry for the loss of time debugging this issue.. The issue has been identified by our internal team and fixed. The fixed version of plugin should be available shortly. Mean while, do you need early access of the fixed version? We are open to giving you an early release to unblock you developing your app. Please let is know. Thanks again for diving into this and bringing the issue into our notice.
10 |5000

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