android-checkout-sdk icon indicating copy to clipboard operation
android-checkout-sdk copied to clipboard

FATAL EXCEPTION: p.f0 Dispatcher

Open wangdabin2333 opened this issue 2 years ago • 5 comments

Before you create a new issue, please search for similar issues. It's possible somebody has encountered this bug already. PLEASE REMOVE THIS LINE TO ACKNOWLEDGE THAT AN ISSUE DOESN'T ALREADY EXIST FOR THIS BUG

Describe the bug There is no problem in the test environment, the formal environment payment will report errors

java.lang.IllegalAccessError: Method 'void com.paypal.pyplcheckout.home.viewmodel.MainPaysheetViewModel.h(com.paypal.pyplcheckout.home.viewmodel.MainPaysheetViewModel)' is inaccessible to class 'b.h0.f.m.b.c' (declaration of 'b.h0.f.m.b.c' appears in /data/app/~~a0Lqr52CIf93otvM-REm3A==/

com.paypal.checkout:android-sdk:0.8.7

I guess it was a mistake caused by confusion? I hope to solve this problem as soon as possible,thanks!

wangdabin2333 avatar Dec 20 '22 02:12 wangdabin2333

I have confirmed that the formal environment can be paid normally after I remove the confusion

wangdabin2333 avatar Dec 20 '22 03:12 wangdabin2333

The problem should be that the paypal callback cannot find the class of the original project after the confusion is added to the project

wangdabin2333 avatar Dec 20 '22 03:12 wangdabin2333

@wangdabin2333 It looks like you are trying to access something that's either internal or private to com.paypal.pyplcheckout.home.viewmodel.MainPaysheetViewModel. You shouldn't really be accessing anything in there.

Could you please make me understand what your use-case is and what you are trying to do?

saperi22 avatar Dec 20 '22 20:12 saperi22

@RequiresApi(api = Build.VERSION_CODES.M) public void invokePayPalPay(AliPayBean.PaypalAndroidVO paypalAndroidVO, BaseActivity context, final DoResult doResult) { PayPalCheckout.startCheckout(new CreateOrder() { @Override public void create(@NonNull CreateOrderActions createOrderActions) { ArrayList<PurchaseUnit> purchaseUnits = new ArrayList<>(); PurchaseUnit purchaseUnit = new PurchaseUnit.Builder() .amount(new Amount.Builder().currencyCode(CurrencyCode.USD) .value(String.valueOf(paypalAndroidVO.getTotal())) .build()) .description(paypalAndroidVO.getOrderDescription()) .customId(paypalAndroidVO.getOrderId()) .build(); purchaseUnits.add(purchaseUnit); Order order = new Order(OrderIntent.CAPTURE, new AppContext.Builder().userAction(UserAction.PAY_NOW).build(), purchaseUnits, ProcessingInstruction.NO_INSTRUCTION); createOrderActions.create(order, (CreateOrderActions.OnOrderCreated) null); } }); PayPalCheckout.registerCallbacks(new OnApprove() { @Override public void onApprove(@NonNull Approval approval) { approval.getOrderActions().capture(new OnCaptureComplete() { @Override public void onCaptureComplete(CaptureOrderResult captureOrderResult) { Log.e(TAG, String.format("CaptureOrderResult: %s", captureOrderResult)); if (captureOrderResult instanceof CaptureOrderResult.Success) { OrderResponse orderResponse = ((CaptureOrderResult.Success) captureOrderResult).getOrderResponse(); if (orderResponse != null) { PurchaseUnit purchaseUnits = orderResponse.getPurchaseUnits().get(0); Payments payments = purchaseUnits.getPayments(); Capture capture = payments.getCaptures().get(0); doResult.confirmSuccess(paypalAndroidVO.getOrderId(), capture.getId()); } else { doResult.confirmError(); } } else if (captureOrderResult instanceof CaptureOrderResult.Error) { doResult.confirmError(); } } }); } }, new OnCancel() { @Override public void onCancel() { doResult.customerCanceled(); } }, new OnError() { @Override public void onError(@NonNull ErrorInfo errorInfo) { doResult.confirmError(); } });

wangdabin2333 avatar Dec 21 '22 08:12 wangdabin2333

@wangdabin2333 - This looks to be an issue with proguard being enabled. When you're running in the test environment, do you have proguard disabled?

tdchow avatar Mar 15 '23 15:03 tdchow