In my android app i have a pop up activity which appears in front of MainActivity with list of products to buy by user. When user chooses product - it calls MainActivity.launchBilling(String skuId)
Pop up activity:
recyclerViewDonate.addOnItemTouchListener(
new RecyclerItemClickListener(this, recyclerViewDonate ,new RecyclerItemClickListener.OnItemClickListener() {
@Override public void onItemClick(View view, int position) {
selectDonateSku = (String) list_sku_id.get(position);
MainActivity.launchBilling(selectDonateSku);
finish();
}
@Override public void onLongItemClick(View view, int position) {
selectDonateSku = (String) list_sku_id.get(position);
MainActivity.launchBilling(selectDonateSku);
finish();
}
})
);
MainActivity:
public static void launchBilling(String skuId){
BillingFlowParams billingFlowParams = BillingFlowParams.newBuilder()
.setSkuDetails(mSkuDetailsMap.get(skuId))
.build();
billingClient.launchBillingFlow(instance, billingFlowParams);
};
Sometines i receive error in report from production. It says that application crashed at BillingFlowParams builder.
I cannot understand what could be the rootcause of this fail. Could someone please advise how to fix this?
Error:
java.lang.IllegalArgumentException: at com.android.billingclient.api.BillingFlowParams$Builder.build(com.android.billingclient:billing@@3.0.0:23)
at com.nosik.ochoforecasts.MainActivity.launchBilling (MainActivity.java:1136)
at com.nosik.ochoforecasts.DonateActivity$1.onItemClick (DonateActivity.java:69)
at com.nosik.ochoforecasts.RecyclerItemClickListener.onInterceptTouchEvent (RecyclerItemClickListener.java:34)
at androidx.recyclerview.widget.RecyclerView.findInterceptingOnItemTouchListener (RecyclerView.java:3151)
at androidx.recyclerview.widget.RecyclerView.dispatchToOnItemTouchListeners (RecyclerView.java:3122)
at androidx.recyclerview.widget.RecyclerView.onTouchEvent (RecyclerView.java:3283)
at android.view.View.dispatchTouchEvent (View.java:14376)
at android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:3857)
at android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:3535)
at android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:3863)
at android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:3551)
at android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:3863)
at android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:3551)
at android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:3863)
at android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:3551)
at android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:3863)
at android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:3551)
at android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:3863)
at android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:3551)
at android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:3863)
at android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:3551)
at com.android.internal.policy.DecorView.superDispatchTouchEvent (DecorView.java:729)
at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent (PhoneWindow.java:1922)
at android.app.Activity.dispatchTouchEvent (Activity.java:4051)
at androidx.appcompat.view.WindowCallbackWrapper.dispatchTouchEvent (WindowCallbackWrapper.java:69)
at com.android.internal.policy.DecorView.dispatchTouchEvent (DecorView.java:687)
at android.view.View.dispatchPointerEvent (View.java:14644)
at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent (ViewRootImpl.java:6478)
at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess (ViewRootImpl.java:6265)
at android.view.ViewRootImpl$InputStage.deliver (ViewRootImpl.java:5703)
at android.view.ViewRootImpl$InputStage.onDeliverToNext (ViewRootImpl.java:5756)
at android.view.ViewRootImpl$InputStage.forward (ViewRootImpl.java:5722)
at android.view.ViewRootImpl$AsyncInputStage.forward (ViewRootImpl.java:5878)
at android.view.ViewRootImpl$InputStage.apply (ViewRootImpl.java:5730)
at android.view.ViewRootImpl$AsyncInputStage.apply (ViewRootImpl.java:5935)
at android.view.ViewRootImpl$InputStage.deliver (ViewRootImpl.java:5703)
at android.view.ViewRootImpl$InputStage.onDeliverToNext (ViewRootImpl.java:5756)
at android.view.ViewRootImpl$InputStage.forward (ViewRootImpl.java:5722)
at android.view.ViewRootImpl$InputStage.apply (ViewRootImpl.java:5730)
at android.view.ViewRootImpl$InputStage.deliver (ViewRootImpl.java:5703)
at android.view.ViewRootImpl.deliverInputEvent (ViewRootImpl.java:8862)
at android.view.ViewRootImpl.doProcessInputEvents (ViewRootImpl.java:8723)
at android.view.ViewRootImpl.enqueueInputEvent (ViewRootImpl.java:8676)
at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent (ViewRootImpl.java:8998)
at android.view.InputEventReceiver.dispatchInputEvent (InputEventReceiver.java:194)
at android.os.MessageQueue.nativePollOnce (Native Method)
at android.os.MessageQueue.next (MessageQueue.java:336)
at android.os.Looper.loop (Looper.java:197)
at android.app.ActivityThread.main (ActivityThread.java:7814)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1068)```
question from:
https://stackoverflow.com/questions/65935107/android-inn-app-billingflowparams-builder-fails-with-java-lang-illegalargumentex 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…