Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android app crashes when paywall is triggered #1127

Open
5 tasks done
khlling opened this issue Nov 10, 2024 · 1 comment
Open
5 tasks done

Android app crashes when paywall is triggered #1127

khlling opened this issue Nov 10, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@khlling
Copy link

khlling commented Nov 10, 2024

Describe the bug
Android crashes when a paywall is triggered. I was using V8.2.6

    "react-native-purchases": "8.2.6",
    "react-native-purchases-ui": "8.2.6",

However, I had to downgrade to v7.28.1 and the paywall appears as expected

    "react-native-purchases": "7.28.1",
    "react-native-purchases-ui": "7.28.1",

My code:

import RevenueCatUI, { PAYWALL_RESULT } from "react-native-purchases-ui";

async function presentPaywall(): Promise<boolean> {
    // Present paywall for current offering:
    const paywallResult: PAYWALL_RESULT = await RevenueCatUI.presentPaywall();
    // or if you need to present a specific offering:
    const paywallResult: PAYWALL_RESULT = await RevenueCatUI.presentPaywall({
        offering: offering // Optional Offering object obtained through getOfferings
    });

    switch (paywallResult) {
        case PAYWALL_RESULT.NOT_PRESENTED:
        case PAYWALL_RESULT.ERROR:
        case PAYWALL_RESULT.CANCELLED:
            return false;
        case PAYWALL_RESULT.PURCHASED:
        case PAYWALL_RESULT.RESTORED:
            return true;
        default:
            return false;
    }
}

async function presentPaywallIfNeeded() {
    // Present paywall for current offering:
    const paywallResult: PAYWALL_RESULT = await RevenueCatUI.presentPaywallIfNeeded({
        requiredEntitlementIdentifier: "pro"
    });
    // If you need to present a specific offering:
    const paywallResult: PAYWALL_RESULT = await RevenueCatUI.presentPaywallIfNeeded({
        offering: offering, // Optional Offering object obtained through getOfferings
        requiredEntitlementIdentifier: "pro"
    });
}
  1. Environment
    1. Platform: Android
    2. SDK version: 34
    3. OS version: 14
    4. Xcode/Android Studio version:
    5. React Native version: 0.74.6
    6. SDK installation (CocoaPods + version or manual):
    7. How widespread is the issue. Percentage of devices affected. - All Android devices
  2. Debug logs that reproduce the issue
  3. Steps to reproduce, with a description of expected vs. actual behavior
  4. Other information (e.g. stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, etc.)
androidx.compose.ui.platform.AndroidComposeView.<init> (AndroidComposeView.android.kt:218)
androidx.compose.ui.platform.Wrapper_androidKt.setContent (Wrapper.android.kt:77)
androidx.compose.ui.platform.AbstractComposeView.ensureCompositionCreated (ComposeView.android.kt:251)
androidx.compose.ui.platform.AbstractComposeView.onAttachedToWindow (ComposeView.android.kt:283)
android.view.View.dispatchAttachedToWindow (View.java:22662)
android.view.ViewGroup.dispatchAttachedToWindow (ViewGroup.java:3495)
android.view.ViewGroup.dispatchAttachedToWindow (ViewGroup.java:3502)
android.view.ViewGroup.dispatchAttachedToWindow (ViewGroup.java:3502)
android.view.ViewGroup.dispatchAttachedToWindow (ViewGroup.java:3502)
android.view.ViewRootImpl.performTraversals (ViewRootImpl.java:3274)
android.view.ViewRootImpl.doTraversal (ViewRootImpl.java:2741)
android.view.ViewRootImpl$TraversalRunnable.run (ViewRootImpl.java:9960)
android.view.Choreographer$CallbackRecord.run (Choreographer.java:1406)
android.view.Choreographer$CallbackRecord.run (Choreographer.java:1415)
android.view.Choreographer.doCallbacks (Choreographer.java:1015)
android.view.Choreographer.doFrame (Choreographer.java:945)
android.view.Choreographer$FrameDisplayEventReceiver.run (Choreographer.java:1389)
android.os.Handler.handleCallback (Handler.java:959)
android.os.Handler.dispatchMessage (Handler.java:100)
android.os.Looper.loopOnce (Looper.java:232)
android.os.Looper.loop (Looper.java:317)
android.app.ActivityThread.main (ActivityThread.java:8592)
java.lang.reflect.Method.invoke (Method.java)
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:580)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:878)

Additional context

@khlling khlling added the bug Something isn't working label Nov 10, 2024
@RCGitBot
Copy link
Contributor

👀 We've just linked this issue to our internal tracker and notified the team. Thank you for reporting, we're checking this out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants