JackAppDev / flutter_iap

Flutter iap plugin
MIT License
100 stars 15 forks source link

Fatal exception in buy for 1.2.2 #36

Closed Lastmanstanding closed 5 years ago

Lastmanstanding commented 6 years ago

The version 1.2.2 for android gives a fatal exception after display of the 'Payment successfull' screen in the purchase dialog. Using version 1.2.1 with exact same code provides no error and a successful registered purchase. We are using the test product 'android.test.purchased' Assume this issue is related to changes for supporting #22 ?

D/BillingManager(31655): Got a verified purchase: Purchase. Json: {"packageName":"<apppath>","orderId":"transactionId.android.test.purchased","productId":"android.test.purchased","developerPayload":"","purchaseTime":0,"purchaseState":0,"purchaseToken":"inapp:_<apppath>_:android.test.purchased"} E/purchases(31655): [Purchase. Json: {"packageName":"<apppath>","orderId":"transactionId.android.test.purchased","productId":"android.test.purchased","developerPayload":"","purchaseTime":0,"purchaseState":0,"purchaseToken":"inapp:<apppath>:android.test.purchased"}] E/Consuming(31655): android.test.purchased D/AndroidRuntime(31655): Shutting down VM E/AndroidRuntime(31655): FATAL EXCEPTION: main E/AndroidRuntime(31655): Process: <apppath>, PID: 31655 E/AndroidRuntime(31655): java.lang.IllegalStateException: Reply already submitted E/AndroidRuntime(31655): at io.flutter.view.FlutterNativeView$1.reply(FlutterNativeView.java:162) E/AndroidRuntime(31655): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.success(MethodChannel.java:194) E/AndroidRuntime(31655): at com.jackappdev.flutteriap.FlutterIapPlugin$3.onPurchasesUpdated(FlutterIapPlugin.java:142) E/AndroidRuntime(31655): at com.jackappdev.flutteriap.BillingManager.onPurchasesUpdated(BillingManager.java:129) E/AndroidRuntime(31655): at com.android.billingclient.api.BillingClientImpl$1.onReceive(BillingClientImpl.java:136) E/AndroidRuntime(31655): at com.android.billingclient.api.LocalBroadcastManager.executePendingBroadcasts(LocalBroadcastManager.java:303) E/AndroidRuntime(31655): at com.android.billingclient.api.LocalBroadcastManager.access$000(LocalBroadcastManager.java:44) E/AndroidRuntime(31655): at com.android.billingclient.api.LocalBroadcastManager$1.handleMessage(LocalBroadcastManager.java:114) E/AndroidRuntime(31655): at android.os.Handler.dispatchMessage(Handler.java:105) E/AndroidRuntime(31655): at android.os.Looper.loop(Looper.java:164) E/AndroidRuntime(31655): at android.app.ActivityThread.main(ActivityThread.java:6944) E/AndroidRuntime(31655): at java.lang.reflect.Method.invoke(Native Method) E/AndroidRuntime(31655): at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327) E/AndroidRuntime(31655): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374) Lost connection to device.

JackAppDev commented 6 years ago

I'm currently on vacation so I'll get to this when I am back.

ened commented 6 years ago

Also having this issue and will check.

ened commented 6 years ago

Problem is in FlutterIapPlugin.java in the "buy" flow. The result is indeed committed twice (once because nothing has been purchased and then again to confirm). Preparing a PR.

JackAppDev commented 6 years ago

Thanks @ened

ened commented 6 years ago

@Lastmanstanding are you able to test the new version directly from Github?

Lastmanstanding commented 5 years ago

Sorry for the late answer. The commited modifications in 1.2.3 works fine. Thanks. There is a different, new, issue, though, but I will register a new one. Current issue can be closed in context of original request.

ened commented 5 years ago

Please close the issue and create new one as proposed. Thx