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

Fatal Exception: X7.L: There is no singleton instance. Make sure you configure Purchases before trying to get the default instance. #269

Open
doolle89 opened this issue Nov 28, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@doolle89
Copy link

doolle89 commented Nov 28, 2024

Since recently I started noticing exception with attached stack trace in Android app, so most probably the problem is introduced in version 1.3.2+13.9.0 or maybe earliest 1.3.1+13.8.0... The strange part is that the app doesn't use Revenucat paywall ui, we create our own paywall uis from from the offering, so there are no references to com.revenuecat.purchases.ui package in the code...
Another interesting thing is that all crashes are from different devices but always the same model: Nexus 5X.
Let me know if you need any additional info to investigate this

Fatal Exception: X7.L: There is no singleton instance. Make sure you configure Purchases before trying to get the default instance. More info here: https://errors.rev.cat/configuring-sdk
       at com.revenuecat.purchases.Purchases$Companion.getSharedInstance(Purchases.kt:886)
       at com.revenuecat.purchases.ui.revenuecatui.data.PurchasesImpl.<init>(PurchasesType.kt:46)
       at com.revenuecat.purchases.ui.revenuecatui.data.PaywallViewModelImpl.<init>(PaywallViewModel.kt:69)
       at com.revenuecat.purchases.ui.revenuecatui.data.PaywallViewModelFactory.create(PaywallViewModelFactory.kt:20)
       at androidx.lifecycle.ViewModelProvider$NewInstanceFactory.create(ViewModelProvider.android.kt:198)
       at androidx.lifecycle.ViewModelProvider$NewInstanceFactory.create(ViewModelProvider.android.kt:203)
       at androidx.lifecycle.viewmodel.ViewModelProviderImpl_androidKt.createViewModel(ViewModelProviderImpl.android.kt:34)
       at androidx.lifecycle.viewmodel.ViewModelProviderImpl.getViewModel$lifecycle_viewmodel_release(ViewModelProviderImpl.kt:65)
       at androidx.lifecycle.ViewModelProvider.get(ViewModelProvider.android.kt:113)
       at androidx.lifecycle.viewmodel.compose.ViewModelKt__ViewModelKt.get(ViewModel.kt:160)
       at androidx.lifecycle.viewmodel.compose.ViewModelKt.get(ViewModel.kt)
       at androidx.lifecycle.viewmodel.compose.ViewModelKt__ViewModel_androidKt.viewModel(ViewModel.android.kt:124)
       at androidx.lifecycle.viewmodel.compose.ViewModelKt.viewModel(ViewModel.kt)
       at com.revenuecat.purchases.ui.revenuecatui.InternalPaywallKt.getPaywallViewModel(InternalPaywall.kt:316)
       at com.revenuecat.purchases.ui.revenuecatui.InternalPaywallKt.InternalPaywall(InternalPaywall.kt:59)
       at com.revenuecat.purchases.ui.revenuecatui.PaywallKt.Paywall(Paywall.kt:11)
       at com.revenuecat.purchases.ui.revenuecatui.activity.PaywallActivity$onCreate$1$1$1.invoke(PaywallActivity.kt:125)
       at com.revenuecat.purchases.ui.revenuecatui.activity.PaywallActivity$onCreate$1$1$1.invoke(PaywallActivity.kt:123)
       at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:118)
       at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35)
       at androidx.compose.material3.ScaffoldKt$ScaffoldLayout$1$1$bodyContentPlaceables$1.invoke(Scaffold.kt:261)
       at androidx.compose.material3.ScaffoldKt$ScaffoldLayout$1$1$bodyContentPlaceables$1.invoke(Scaffold.kt:238)
       at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:109)
       at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35)
       at androidx.compose.ui.layout.LayoutNodeSubcompositionsState$subcompose$3$1$1.invoke(SubcomposeLayout.kt:1017)
       at androidx.compose.ui.layout.LayoutNodeSubcompositionsState$subcompose$3$1$1.invoke(SubcomposeLayout.kt:493)
       at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:109)
       at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35)
       at androidx.compose.runtime.ActualJvm_jvmKt.invokeComposable(ActualJvm.jvm.kt:97)
       at androidx.compose.runtime.ComposerImpl.doCompose(Composer.kt:3595)
       at androidx.compose.runtime.ComposerImpl.composeContent$runtime_release(Composer.kt:3522)
       at androidx.compose.runtime.CompositionImpl.composeContent(Composition.kt:743)
       at androidx.compose.runtime.Recomposer.composeInitial$runtime_release(Recomposer.kt:1122)
       at androidx.compose.runtime.ComposerImpl$CompositionContextImpl.composeInitial$runtime_release(Composer.kt:3876)
       at androidx.compose.runtime.CompositionImpl.composeInitial(Composition.kt:649)
       at androidx.compose.runtime.CompositionImpl.setContent(Composition.kt)
       at androidx.compose.ui.layout.LayoutNodeSubcompositionsState.subcomposeInto(SubcomposeLayout.kt:516)
       at androidx.compose.ui.layout.LayoutNodeSubcompositionsState.subcompose(SubcomposeLayout.kt:488)
       at androidx.compose.ui.layout.LayoutNodeSubcompositionsState.subcompose(SubcomposeLayout.kt:479)
       at androidx.compose.ui.layout.LayoutNodeSubcompositionsState.subcompose(SubcomposeLayout.kt:463)
       at androidx.compose.ui.layout.LayoutNodeSubcompositionsState$Scope.subcompose(SubcomposeLayout.kt:895)
       at androidx.compose.material3.ScaffoldKt$ScaffoldLayout$1$1.invoke-0kLqBqw(Scaffold.kt:238)
       at androidx.compose.material3.ScaffoldKt$ScaffoldLayout$1$1.invoke(Scaffold.kt:140)
       at androidx.compose.ui.layout.LayoutNodeSubcompositionsState$createMeasurePolicy$1.measure-3p2s80s(SubcomposeLayout.kt:725)
       at androidx.compose.ui.node.InnerNodeCoordinator.measure-BRTryo0(InnerNodeCoordinator.kt:135)
       at androidx.compose.ui.node.LayoutNodeLayoutDelegate$performMeasureBlock$1.invoke(LayoutNodeLayoutDelegate.kt:316)
       at androidx.compose.ui.node.LayoutNodeLayoutDelegate$performMeasureBlock$1.invoke(LayoutNodeLayoutDelegate.kt:315)
       at androidx.compose.runtime.snapshots.Snapshot$Companion.observe(Snapshot.kt:503)
       at androidx.compose.runtime.snapshots.SnapshotStateObserver$ObservedScopeMap.observe(SnapshotStateObserver.kt:502)
       at androidx.compose.runtime.snapshots.SnapshotStateObserver.observeReads(SnapshotStateObserver.kt:258)
       at androidx.compose.ui.node.OwnerSnapshotObserver.observeReads$ui_release(OwnerSnapshotObserver.kt:133)
       at androidx.compose.ui.node.OwnerSnapshotObserver.observeMeasureSnapshotReads$ui_release(OwnerSnapshotObserver.kt:113)
       at androidx.compose.ui.node.LayoutNodeLayoutDelegate.performMeasure-BRTryo0(LayoutNodeLayoutDelegate.kt:1782)
       at androidx.compose.ui.node.LayoutNodeLayoutDelegate.access$performMeasure-BRTryo0(LayoutNodeLayoutDelegate.kt)
       at androidx.compose.ui.node.LayoutNodeLayoutDelegate$MeasurePassDelegate.remeasure-BRTryo0(LayoutNodeLayoutDelegate.kt:696)
       at androidx.compose.ui.node.LayoutNodeLayoutDelegate$MeasurePassDelegate.measure-BRTryo0(LayoutNodeLayoutDelegate.kt:672)
       at androidx.compose.foundation.layout.BoxMeasurePolicy.measure-3p2s80s(Box.kt:151)
       at androidx.compose.ui.node.InnerNodeCoordinator.measure-BRTryo0(InnerNodeCoordinator.kt:135)
       at androidx.compose.ui.graphics.SimpleGraphicsLayerModifier.measure-3p2s80s(GraphicsLayerModifier.kt)
       at androidx.compose.ui.node.LayoutModifierNodeCoordinator.measure-BRTryo0(LayoutModifierNodeCoordinator.kt:188)
       at androidx.compose.ui.node.LayoutNodeLayoutDelegate$performMeasureBlock$1.invoke(LayoutNodeLayoutDelegate.kt:316)
       at androidx.compose.ui.node.LayoutNodeLayoutDelegate$performMeasureBlock$1.invoke(LayoutNodeLayoutDelegate.kt:315)
       at androidx.compose.runtime.snapshots.Snapshot$Companion.observe(Snapshot.kt:503)
       at androidx.compose.runtime.snapshots.SnapshotStateObserver$ObservedScopeMap.observe(SnapshotStateObserver.kt:502)
       at androidx.compose.runtime.snapshots.SnapshotStateObserver.observeReads(SnapshotStateObserver.kt:258)
       at androidx.compose.ui.node.OwnerSnapshotObserver.observeReads$ui_release(OwnerSnapshotObserver.kt:133)
       at androidx.compose.ui.node.OwnerSnapshotObserver.observeMeasureSnapshotReads$ui_release(OwnerSnapshotObserver.kt:113)
       at androidx.compose.ui.node.LayoutNodeLayoutDelegate.performMeasure-BRTryo0(LayoutNodeLayoutDelegate.kt:1782)
       at androidx.compose.ui.node.LayoutNodeLayoutDelegate.access$performMeasure-BRTryo0(LayoutNodeLayoutDelegate.kt)
       at androidx.compose.ui.node.LayoutNodeLayoutDelegate$MeasurePassDelegate.remeasure-BRTryo0(LayoutNodeLayoutDelegate.kt:696)
       at androidx.compose.ui.node.LayoutNodeLayoutDelegate$MeasurePassDelegate.measure-BRTryo0(LayoutNodeLayoutDelegate.kt:672)
       at androidx.compose.ui.layout.RootMeasurePolicy.measure-3p2s80s(RootMeasurePolicy.kt:38)
       at androidx.compose.ui.node.InnerNodeCoordinator.measure-BRTryo0(InnerNodeCoordinator.kt:135)
       at androidx.compose.ui.node.LayoutNodeLayoutDelegate$performMeasureBlock$1.invoke(LayoutNodeLayoutDelegate.kt:316)
       at androidx.compose.ui.node.LayoutNodeLayoutDelegate$performMeasureBlock$1.invoke(LayoutNodeLayoutDelegate.kt:315)
       at androidx.compose.runtime.snapshots.Snapshot$Companion.observe(Snapshot.kt:2441)
       at androidx.compose.runtime.snapshots.SnapshotStateObserver$ObservedScopeMap.observe(SnapshotStateObserver.kt:502)
       at androidx.compose.runtime.snapshots.SnapshotStateObserver.observeReads(SnapshotStateObserver.kt:258)
       at androidx.compose.ui.node.OwnerSnapshotObserver.observeReads$ui_release(OwnerSnapshotObserver.kt:133)
       at androidx.compose.ui.node.OwnerSnapshotObserver.observeMeasureSnapshotReads$ui_release(OwnerSnapshotObserver.kt:113)
       at androidx.compose.ui.node.LayoutNodeLayoutDelegate.performMeasure-BRTryo0(LayoutNodeLayoutDelegate.kt:1782)
       at androidx.compose.ui.node.LayoutNodeLayoutDelegate.access$performMeasure-BRTryo0(LayoutNodeLayoutDelegate.kt)
       at androidx.compose.ui.node.LayoutNodeLayoutDelegate$MeasurePassDelegate.remeasure-BRTryo0(LayoutNodeLayoutDelegate.kt:696)
       at androidx.compose.ui.node.LayoutNode.remeasure-_Sx5XlM$ui_release(LayoutNode.kt:1222)
       at androidx.compose.ui.node.MeasureAndLayoutDelegate.doRemeasure-sdFAvZA(MeasureAndLayoutDelegate.kt:367)
       at androidx.compose.ui.node.MeasureAndLayoutDelegate.remeasureOnly(MeasureAndLayoutDelegate.kt:622)
       at androidx.compose.ui.node.MeasureAndLayoutDelegate.measureOnly(MeasureAndLayoutDelegate.kt:420)
       at androidx.compose.ui.platform.AndroidComposeView.onMeasure(AndroidComposeView.android.kt:1370)
       at android.view.View.measure(View.java:26357)
       at androidx.compose.ui.platform.AbstractComposeView.internalOnMeasure$ui_release(ComposeView.android.kt:309)
       at androidx.compose.ui.platform.AbstractComposeView.onMeasure(ComposeView.android.kt:296)
       at android.view.View.measure(View.java:26357)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6981)
       at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
       at android.view.View.measure(View.java:26357)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6981)
       at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1608)
       at android.widget.LinearLayout.measureVertical(LinearLayout.java:878)
       at android.widget.LinearLayout.onMeasure(LinearLayout.java:721)
       at android.view.View.measure(View.java:26357)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6981)
       at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
       at com.android.internal.policy.DecorView.onMeasure(DecorView.java:760)
       at android.view.View.measure(View.java:26357)
       at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:3926)
       at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:2612)
       at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2884)
       at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2328)
       at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:9087)
       at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1231)
       at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1239)
       at android.view.Choreographer.doCallbacks(Choreographer.java:899)
       at android.view.Choreographer.doFrame(Choreographer.java:832)
       at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1214)
       at android.os.Handler.handleCallback(Handler.java:942)
       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:7872)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
@doolle89 doolle89 added the bug Something isn't working label Nov 28, 2024
@JayShortway
Copy link
Member

Hi @doolle89, thanks for reporting this. That is indeed odd. It seems like a Scaffold is starting the PaywallActivity 🤔

To debug this, could you share the output of ./gradlew app:dependencies? (Where app is your app's Gradle module.) The output is probably very big, so might be good to make a gist and share that instead. If you don't want to share publicly, feel free to send the gist via DM on social media (linked in my GitHub profile).

@doolle89
Copy link
Author

We have gradle dependency to com.revenuecat.purchases:purchases-kmp-ui:1.3.2+13.9.0, and it resolves to com.revenuecat.purchases:purchases-ui:8.10.2 if that's what are you looking for, but it's not used later in the code...
I have never used Paywall UI feature so I am not familiar how it works, maybe it does something only by including the dependency?
If you like to see all resolved dependencies related to com.revenuecat.purchases:purchases-kmp I can share that with you too, it's not that long, probably similar as stack trace provided above...

@JayShortway
Copy link
Member

Thanks, that was indeed what I was looking for. I thought the dependency might have been included transitively somehow.

I'm assuming this stack trace is from a Crashlytics-like service. Are you able to reproduce this locally? Do you have any other information about the state of the app when this happens, e.g. is the app in the background, are the users on a specific screen in you app, are they pressing certain buttons?

If you don't need the Paywalls SDK, it's definitely worth a try to exclude it and see if the problem goes away.

@doolle89
Copy link
Author

doolle89 commented Dec 2, 2024

Yeah, I figured out that the dependency could be the problem, so it's removed it the same day I reported the issue and so far there no new crashes.

You are right the stack trace is from Crashlytics, I haven't seen it locally, so I don't have much insight when it happens, the only interesting info I noticed is that it only happens on Nexus 5X devices. We configure sdk on user login so most probably the user in not logged in this case, but no any specific evidence about it...

@JayShortway
Copy link
Member

Okay that's good to know that there are no new crashes (yet) with the dependency removed.

Do you have any breadcrumbs on Crashlytics? Even the default screen_view ones could be useful. I think you should also be able to see the percentage of foreground/background crashes on Crashlytics. (I expect 100% foreground looking at the stack trace, but would be good to verify.)

Do the Android versions differ at all on the Nexus 5X devices, or is it 100% Android 8.1?

@doolle89
Copy link
Author

doolle89 commented Dec 3, 2024

Ok, I see what you mean, it's 0% background (or 100% foreground :D), it's 50% Android 8.1 and 50% Android 13...
I ll send you more info in the private msg

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