question

Vladimir Davidovich avatar image
Vladimir Davidovich asked

[Android 5.0] crash because of "Service intent must be explicit" exception

We use in-app-purchasing-1.0.7.jar in application with target=android-21 (this means Android 5.0 as a base SDK). Looks like Amazon SDK is not yet compatible with such target, here is a stacktrace from Nexus 5 with Android 5.0 installed: 11-19 17:14:58.917: D/SandboxRequestHandler(25160): In App Purchasing SDK - Sandbox Mode: sendGetUserIdRequest 11-19 17:14:58.918: E/AndroidRuntime(25160): FATAL EXCEPTION: PurchasingManagerHandlerThread 11-19 17:14:58.918: E/AndroidRuntime(25160): Process: com.g5e.kdtest.amzn, PID: 25160 11-19 17:14:58.918: E/AndroidRuntime(25160): java.lang.IllegalArgumentException: Service Intent must be explicit: Intent { act=com.amazon.testclient.iap.appUserId flg=0x10000000 (has extras) } 11-19 17:14:58.918: E/AndroidRuntime(25160): at android.app.ContextImpl.validateServiceIntent(ContextImpl.java:1674) 11-19 17:14:58.918: E/AndroidRuntime(25160): at android.app.ContextImpl.startServiceCommon(ContextImpl.java:1703) 11-19 17:14:58.918: E/AndroidRuntime(25160): at android.app.ContextImpl.startService(ContextImpl.java:1687) 11-19 17:14:58.918: E/AndroidRuntime(25160): at android.content.ContextWrapper.startService(ContextWrapper.java:515) 11-19 17:14:58.918: E/AndroidRuntime(25160): at com.amazon.inapp.purchasing.SandboxRequestHandler.sendGetUserIdRequest(SandboxRequestHandler.java:43) 11-19 17:14:58.918: E/AndroidRuntime(25160): at com.amazon.inapp.purchasing.GetUserIdRequest$1.run(GetUserIdRequest.java:13) 11-19 17:14:58.918: E/AndroidRuntime(25160): at android.os.Handler.handleCallback(Handler.java:739) 11-19 17:14:58.918: E/AndroidRuntime(25160): at android.os.Handler.dispatchMessage(Handler.java:95) 11-19 17:14:58.918: E/AndroidRuntime(25160): at android.os.Looper.loop(Looper.java:135) 11-19 17:14:58.918: E/AndroidRuntime(25160): at android.os.HandlerThread.run(HandlerThread.java:61) Message was edited by: Vladimir Davidovich
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.

Nick Gardner avatar image
Nick Gardner answered
Hi, Today we released new versions of the IAP SDK for both v1 and v2 that should fix incompatibility issues with Android 5.0.
10 |5000

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

blood585 avatar image
blood585 answered
Hello! I downloaded a latest SDK for Unity and build demo. 03-20 08:52:08.948: E/AndroidRuntime(9762): FATAL EXCEPTION: PurchasingManagerHandlerThread 03-20 08:52:08.948: E/AndroidRuntime(9762): Process: com.amazon.iaptest, PID: 9762 03-20 08:52:08.948: E/AndroidRuntime(9762): java.lang.Error: FATAL EXCEPTION [PurchasingManagerHandlerThread] 03-20 08:52:08.948: E/AndroidRuntime(9762): Unity version : 4.6.3p2 03-20 08:52:08.948: E/AndroidRuntime(9762): Device model : LGE Nexus 5 03-20 08:52:08.948: E/AndroidRuntime(9762): Device fingerprint: google/hammerhead/hammerhead:5.0.1/LRX22C/1602158:user/release-keys 03-20 08:52:08.948: E/AndroidRuntime(9762): Caused by: java.lang.IllegalArgumentException: Service Intent must be explicit: Intent { act=com.amazon.testclient.iap.appUserId flg=0x10000000 (has extras) } 03-20 08:52:08.948: E/AndroidRuntime(9762): at android.app.ContextImpl.validateServiceIntent(ContextImpl.java:1674) 03-20 08:52:08.948: E/AndroidRuntime(9762): at android.app.ContextImpl.startServiceCommon(ContextImpl.java:1703) 03-20 08:52:08.948: E/AndroidRuntime(9762): at android.app.ContextImpl.startService(ContextImpl.java:1687) 03-20 08:52:08.948: E/AndroidRuntime(9762): at android.content.ContextWrapper.startService(ContextWrapper.java:515) 03-20 08:52:08.948: E/AndroidRuntime(9762): at com.amazon.inapp.purchasing.SandboxRequestHandler.sendGetUserIdRequest(Unknown Source) 03-20 08:52:08.948: E/AndroidRuntime(9762): at com.amazon.inapp.purchasing.GetUserIdRequest$1.run(Unknown Source) 03-20 08:52:08.948: E/AndroidRuntime(9762): at android.os.Handler.handleCallback(Handler.java:739) 03-20 08:52:08.948: E/AndroidRuntime(9762): at android.os.Handler.dispatchMessage(Handler.java:95) 03-20 08:52:08.948: E/AndroidRuntime(9762): at android.os.Looper.loop(Looper.java:135) 03-20 08:52:08.948: E/AndroidRuntime(9762): at android.os.HandlerThread.run(HandlerThread.java:61) 03-20 08:52:08.951: W/ActivityManager(746): Force finishing activity com.amazon.iaptest/com.unity3d.player.UnityPlayerNativeActivity
10 |5000

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

DougM@Amazon avatar image
DougM@Amazon answered
Hello, Please make sure to follow the procedure we document in "How to update the In-App Purchasing v1 plugin for Unity to work in Lollipop" at https://forums.developer.amazon.com/forums/thread.jspa?messageID=14997㪕 . If you do not, the In-App Purchasing SDK JAR file that will be built into your Unity game will still be version 1.0.3, which is still affected by the bug that this thread reports.
10 |5000

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