question

Amazon Customer avatar image
Amazon Customer asked

IAP v2 Sandbox: context must not be null

When trying to test my IAP implementation in the sandbox, I get the following exception in obfuscated code. Is there any suggestion on how to fix this? D/c (28030): In App Purchasing SDK - Sandbox Mode: handleResponse I/c (28030): sendGetPurchaseUpdates with user idl3HL7XppEMhrOGDnur9-ulvqomrSg6qyODKmah76lJU= E/c (28030): Error handling response. E/c (28030): java.lang.IllegalArgumentException: context must not be null E/c (28030): at com.amazon.device.iap.internal.util.d.a(Validator.java:13) E/c (28030): at com.amazon.device.iap.internal.util.b.a(CursorUtil.java:34) E/c (28030): at com.amazon.device.iap.internal.a.c.a(SandboxRequestHandler.java:398) E/c (28030): at com.amazon.device.iap.internal.a.c.e(SandboxRequestHandler.java:386) E/c (28030): at com.amazon.device.iap.internal.a.c.a(SandboxRequestHandler.java:190) E/c (28030): at com.amazon.device.iap.internal.d.a(PurchasingManager.java:130) E/c (28030): at com.amazon.device.iap.ResponseReceiver.onReceive(ResponseReceiver.java:47) E/c (28030): at android.app.ActivityThread.handleReceiver(ActivityThread.java:2201) E/c (28030): at android.app.ActivityThread.access$1500(ActivityThread.java:127) E/c (28030): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1231) E/c (28030): at android.os.Handler.dispatchMessage(Handler.java:99) E/c (28030): at android.os.Looper.loop(Looper.java:137) E/c (28030): at android.app.ActivityThread.main(ActivityThread.java:4558) E/c (28030): at java.lang.reflect.Method.invokeNative(Native Method) E/c (28030): at java.lang.reflect.Method.invoke(Method.java:511) E/c (28030): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784) E/c (28030): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551) E/c (28030): at dalvik.system.NativeStart.main(Native Method)
iap
10 |5000

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

Amazon Customer avatar image
Amazon Customer answered
For the record, this seems to have something to do with the android:process attribute being present on the activity tag. Since it wasn't strictly necessary for this application, I removed it, and the problem went away. (I still have no idea what the root cause was.)
10 |5000

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

Nick Gardner avatar image
Nick Gardner answered
Hi, This issue should be fixed in the latest version of the SDK. Please let us know if this error still happens when you download the latest version from our site.
10 |5000

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

Christine Rosalie Fawcett avatar image
Christine Rosalie Fawcett answered
I am getting exactly the same crash. I don't have any process tag on my Activity and I am using v2.0 in-app purchasing library. Is there another Amazon library I need to update? The Sample Entitlement App runs OK.
10 |5000

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

Christine Rosalie Fawcett avatar image
Christine Rosalie Fawcett answered
With regard to my previous post and I am using version 2.0.61 of the library
10 |5000

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

Christine Rosalie Fawcett avatar image
Christine Rosalie Fawcett answered
I figured it out. I was missing the call to the Super in onResume. The crash went away when I restored that
10 |5000

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