lukaspili / Reactive-Billing

Lightweight reactive wrapper around In App Billing API v3 for Android
https://play.google.com/store/apps/details?id=com.github.lukaspili.reactivebilling.sample
MIT License
246 stars 33 forks source link

Possible to test with reserved product ID? #2

Open klwoon opened 8 years ago

klwoon commented 8 years ago

Was testing with android.test.purchased and it was successful, however will get the following crash if test with android.test.canceled or android.test.refunded:

FATAL EXCEPTION: main Process: com.example, PID: 25280 java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=1337, result=-1, data=Intent { (has extras) }} to activity {com.example/com.github.lukaspili.reactivebilling.ReactiveBillingShadowActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.String.length()' on a null object reference at android.app.ActivityThread.deliverResults(ActivityThread.java:3574) at android.app.ActivityThread.handleSendResult(ActivityThread.java:3617) at android.app.ActivityThread.access$1300(ActivityThread.java:151) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1352) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5254) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698) Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.String.length()' on a null object reference at org.json.JSONTokener.nextCleanInternal(JSONTokener.java:116) at org.json.JSONTokener.nextValue(JSONTokener.java:94) at org.json.JSONObject.<init>(JSONObject.java:156) at org.json.JSONObject.<init>(JSONObject.java:173) at com.github.lukaspili.reactivebilling.parser.PurchaseParser.parse(PurchaseParser.java:19) at com.github.lukaspili.reactivebilling.PurchaseFlowService.onActivityResult(PurchaseFlowService.java:86) at com.github.lukaspili.reactivebilling.ReactiveBillingShadowActivity.onActivityResult(ReactiveBillingShadowActivity.java:87) at android.app.Activity.dispatchActivityResult(Activity.java:6192) at android.app.ActivityThread.deliverResults(ActivityThread.java:3570) at android.app.ActivityThread.handleSendResult(ActivityThread.java:3617)  at android.app.ActivityThread.access$1300(ActivityThread.java:151)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1352)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:135)  at android.app.ActivityThread.main(ActivityThread.java:5254)  at java.lang.reflect.Method.invoke(Native Method)  at java.lang.reflect.Method.invoke(Method.java:372)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698) 

lukaspili commented 8 years ago

Thanks for the report, I actually didn't tested with android.test.canceled and android.test.refunded products. I will do, and fix this for tomorrow.