Question

App crashes when i try to show a pay wall in react native (Android)

  • 4 April 2024
  • 4 replies
  • 180 views

Badge +4

When i try to open a paywall the apps crashes without returning any error.

With Flipper Crash Reporter i can see the error :

FATAL EXCEPTION: main
Process: com.dev12br.coupleGame, PID: 19923
java.lang.IllegalStateException: ViewTreeLifecycleOwner not found from android.widget.FrameLayout{b1c81c V.E...... ......I. 0,0-0,0}
at androidx.compose.ui.platform.WindowRecomposer_androidKt.createLifecycleAwareWindowRecomposer(WindowRecomposer.android.kt:352)
at androidx.compose.ui.platform.WindowRecomposer_androidKt.createLifecycleAwareWindowRecomposer$default(WindowRecomposer.android.kt:325)
at androidx.compose.ui.platform.WindowRecomposerFactory$Companion$LifecycleAware$1.createRecomposer(WindowRecomposer.android.kt:168)
at androidx.compose.ui.platform.WindowRecomposerPolicy.createAndInstallWindowRecomposer$ui_release(WindowRecomposer.android.kt:224)
at androidx.compose.ui.platform.WindowRecomposer_androidKt.getWindowRecomposer(WindowRecomposer.android.kt:300)
at androidx.compose.ui.platform.AbstractComposeView.resolveParentCompositionContext(ComposeView.android.kt:244)
at androidx.compose.ui.platform.AbstractComposeView.ensureCompositionCreated(ComposeView.android.kt:251)
at androidx.compose.ui.platform.AbstractComposeView.onAttachedToWindow(ComposeView.android.kt:283)
at android.view.View.dispatchAttachedToWindow(View.java:21092)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3501)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3508)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3508)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3508)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3508)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3508)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3508)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3508)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2767)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2272)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:8999)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1160)
at android.view.Choreographer.doCallbacks(Choreographer.java:950)
at android.view.Choreographer.doFrame(Choreographer.java:879)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1142)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:210)
at android.os.Looper.loop(Looper.java:299)
at android.app.ActivityThread.main(ActivityThread.java:8319)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:556)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1038)


Lib versions :

{
"react-native-purchases": "^7.25.0",
"react-native-purchases-ui": "^7.25.0",
}

build.gradle :
 


buildscript {
ext {
buildToolsVersion = "33.0.0"
minSdkVersion = 24
compileSdkVersion = 34
targetSdkVersion = 34
supportLibVersion = "28.0.0"


ndkVersion = "23.1.7779620"
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.google.gms:google-services:4.3.15'
classpath("com.android.tools.build:gradle:7.3.1")
classpath("com.facebook.react:react-native-gradle-plugin")
}
}

 


This post has been closed for comments

4 replies

Badge +2

Same

Userlevel 4
Badge +6

Hi @emilio-66c117 and @onlyhumn.nathan,

It looks like the error at the top `IllegalStateException: ViewTreeLifecycleOwner not found...` tends to indicate a dependency or version issue, based on some Stack Overflow threads I’m reading.

Badge +2

Thanks @kaitlin. We’ve tried the compat recommendations but no change. Here are the full Logcat logs
https://drive.google.com/file/d/1y7Pc7JI50NcIUmYON3BZZNGdDf4LefqT/view?usp=sharing

Interesting before the exception I see `2024-04-09 13:21:02.100  9427-9515  unknown:Vi...rtyUpdater app.memlane                          W  Could not find generated setter for class com.revenuecat.purchases.react.ui.PaywallViewShadowNode`

Badge +2

Ok, it turns out this was a local issue, though, it was fine a week or two ago and we didn’t make any changes. We use https://github.com/susonthapa/react-native-global-modal and it seems if we switch back to using the normal navigation.navigate for our SubscribeModal, it works again.