Hey there,
Fetching the offers works as expected, but purchasing them results in an app crash.
The crash only happens on android, ios works fine.
I am on react-native-purchases v4.5.0.
Testing on a Real Android device
I am coming from the react-native-iap (5.2.14) package, I uninstalled the react-native-iap package already, but I am not sure if it might is related to that lib, something i forgot to clean up?
I checked that the Purchases instance isConfigured:
const configured = await Purchases.isConfigured();
I tried both methods, purchaseProduct and purchasePackage, both crashed.
LOGS:
revenueCat Logs:
Retrieved skuDetailsList: SkuDetails: {"productId":"com.docomondo.yearly","type":"subs","title":"docomondo Premium (docomondo - dein smarter Dateimanager)","name":"docomondo Premium","price":"CHF 42.00","price_amount_micros":42000000,"price_currency_code":"CHF","description":"Benefit from all available Features!","subscriptionPeriod":"P1Y","freeTrialPeriod":"P4W2D","skuDetailsToken":"AEu..."}
com.docomondo.yearly - SkuDetails: {"productId":"com.docomondo.yearly","type":"subs","title":"docomondo Premium (docomondo - dein smarter Dateimanager)","name":"docomondo Premium","price":"CHF 42.00","price_amount_micros":42000000,"price_currency_code":"CHF","description":"Benefit from all available Features!","subscriptionPeriod":"P1Y","freeTrialPeriod":"P4W2D","skuDetailsToken":"AEu..."}
Purchase started - product: com.revenuecat.purchases.models.ProductDetails@69d410c null
Purchasing product: com.docomondo.yearly
crash logs android studio:
--------- beginning of crash
2021-12-27 21:50:20.811 17807-17807/com.docomondo.manager E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.docomondo.manager, PID: 17807
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.Intent.getStringExtra(java.lang.String)' on a null object reference
at com.android.billingclient.api.BillingClientImpl.launchBillingFlow(com.android.billingclient:billing@@4.0.0:56)
at com.revenuecat.purchases.google.BillingWrapper$launchBillingFlow$1.invoke(BillingWrapper.kt:226)
at com.revenuecat.purchases.google.BillingWrapper$launchBillingFlow$1.invoke(BillingWrapper.kt:53)
at com.revenuecat.purchases.google.BillingWrapper.withConnectedClient(BillingWrapper.kt:593)
at com.revenuecat.purchases.google.BillingWrapper.launchBillingFlow(BillingWrapper.kt:225)
at com.revenuecat.purchases.google.BillingWrapper.access$launchBillingFlow(BillingWrapper.kt:53)
at com.revenuecat.purchases.google.BillingWrapper$makePurchaseAsync$2.invoke(BillingWrapper.kt:216)
at com.revenuecat.purchases.google.BillingWrapper$makePurchaseAsync$2.invoke(BillingWrapper.kt:53)
at com.revenuecat.purchases.google.BillingWrapper$executePendingRequests$1$1$1.run(BillingWrapper.kt:81)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7839)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)