This is the Crash Report I got from the Play Console:
Type
1java.lang.NullPointerException1Exception java.lang.NullPointerException:2 at com.revenuecat.purchases.PurchaseParams$Builder.<init> (PurchaseParams.kt)3 at com.xxxxxxxxxxxx.MainActivity.purchase (MainActivity.java:2103)4 at com.xxxxxxxxxxxx.MainActivity.lambda$showPaywall$33 (MainActivity.java:2014)5 at android.view.View.performClick (View.java:7792)6 at android.widget.TextView.performClick (TextView.java:16112)7 at android.view.View.performClickInternal (View.java:7769)8 at android.view.View.access$3800 (View.java:910)9 at android.view.View$PerformClick.run (View.java:30218)10 at android.os.Handler.handleCallback (Handler.java:938)11 at android.os.Handler.dispatchMessage (Handler.java:99)12 at android.os.Looper.loopOnce (Looper.java:226)13 at android.os.Looper.loop (Looper.java:313)14 at android.app.ActivityThread.main (ActivityThread.java:8751)15 at java.lang.reflect.Method.invoke16 at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:571)17 at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1135)Here is my code:
1 protected void purchase(Package purchasePackage) {2 Log.d(TAG_REVENUECAT, "RC: Purchases.getSharedInstance().purchase");3 Purchases.getSharedInstance().purchase(4 new PurchaseParams.Builder(this, purchasePackage).build(), new PurchaseCallback() {5 @Override6 public void onCompleted(@NonNull StoreTransaction storeTransaction, @NonNull CustomerInfo customerInfo) {7 if (customerInfo.getEntitlements().get(PREMIUM_ENTITLEMENT_ID) != null) {8 if (Objects.requireNonNull(customerInfo.getEntitlements().get(PREMIUM_ENTITLEMENT_ID)).isActive()) {9 // Unlock that great "pro" content10 Log.d(TAG_REVENUECAT, "RC: Purchase completed");11 AlertDialog.Builder alertBuilder = new AlertDialog.Builder(MainActivity.this);12 alertBuilder.setTitle(R.string.thankyou)13 .setCancelable(false)14 .setPositiveButton(android.R.string.ok, (dialog, id) -> {})15 .show();16 enablePremium(true);17 }18 }19 }20 @Override21 public void onError(@NonNull PurchasesError purchasesError, boolean userCancelled) {22 // No purchase23 Log.e(TAG_REVENUECAT, purchasesError.toString());24 Log.d(TAG_REVENUECAT, "Purchase error");25 if (!userCancelled) {26 showErrorAlert(purchasesError);27 }28 }29 }30 );31 }About 1% of users affected. I suspect “storeTransaction” or “customerInfo” having null.
1public void onCompleted(@NonNull StoreTransaction storeTransaction, @NonNull CustomerInfo customerInfo)Should I check
customerInfo.getEntitlements() != null too?

