Skip to content

Can't show paywall for payment using React Native 0.69.5 #135

@Hi-Fella

Description

@Hi-Fella

Description

How to solve this issue? The react-native-adapty library was successfully installed, and i able to run the project, but when the code tryin to show the paywall, it force close the app.

useEffect to trigger the paywall ui:

  useEffect(() => {
    fetchPaywall()
    return () => {
    }
  }, [])

fetchPaywall method:

  const fetchPaywall = async () => {
    try {
      const placementId = '<the placement id>';
      const locale = 'en';

      const paywall = await adapty.getPaywall(placementId, locale);

      const view = await createPaywallView(paywall);
      view.registerEventHandlers(); // handle close press, etc

      try {
        await view.present();
      } catch (error) {
        // handle the error
        console.log(error)
      }

    } catch (error) {
      // handle the error
      console.log(error)
    }
  }

Environment:

dependencies {
        classpath('com.android.tools.build:gradle:7.2.1')
        // classpath('com.android.tools.build:gradle:8.2.1')
        classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version")
        classpath("com.facebook.react:react-native-gradle-plugin")
        classpath("de.undercouch:gradle-download-task:5.0.1")
        classpath 'com.google.gms:google-services:4.3.3'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files

        //firebase dependencies
        classpath 'com.google.gms:google-services:4.3.15'
    }
  • android/app/build.gradle:
    configurations.all {
        resolutionStrategy.eachDependency { DependencyResolveDetails details ->
            if (details.requested.group == 'androidx.lifecycle') {
                details.useVersion "2.6.2"
            }
            if (details.requested.group == 'com.facebook.soloader' && details.requested.name == 'soloader') {
                details.useVersion '0.10.4'
            }
        }
    }

Error/Issue:
This log is generated by running command adb logcat "*:E"

02-05 11:57:16.085 17990 17990 E AndroidRuntime: Process: com.XXXXX, PID: 17990
02-05 11:57:16.085 17990 17990 E AndroidRuntime: java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/lifecycle/compose/LocalLifecycleOwnerKt;
02-05 11:57:16.085 17990 17990 E AndroidRuntime:        at androidx.compose.ui.platform.AndroidCompositionLocals_androidKt.ProvideAndroidCompositionLocals(AndroidCompositionLocals.android.kt:124)
02-05 11:57:16.085 17990 17990 E AndroidRuntime:        at androidx.compose.ui.platform.WrappedComposition$setContent$1$1$3.invoke(Wrapper.android.kt:155)
02-05 11:57:16.085 17990 17990 E AndroidRuntime:        at androidx.compose.ui.platform.WrappedComposition$setContent$1$1$3.invoke(Wrapper.android.kt:154)
02-05 11:57:16.085 17990 17990 E AndroidRuntime:        at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:109)
02-05 11:57:16.085 17990 17990 E AndroidRuntime:        at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35)
02-05 11:57:16.085 17990 17990 E AndroidRuntime:        at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:401)
02-05 11:57:16.085 17990 17990 E AndroidRuntime:        at androidx.compose.ui.platform.WrappedComposition$setContent$1$1.invoke(Wrapper.android.kt:154)
02-05 11:57:16.085 17990 17990 E AndroidRuntime:        at androidx.compose.ui.platform.WrappedComposition$setContent$1$1.invoke(Wrapper.android.kt:133)
02-05 11:57:16.085 17990 17990 E AndroidRuntime:        at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:109)
02-05 11:57:16.085 17990 17990 E AndroidRuntime:        at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35)
02-05 11:57:16.085 17990 17990 E AndroidRuntime:        at androidx.compose.runtime.ActualJvm_jvmKt.invokeComposable(ActualJvm.jvm.kt:97)
02-05 11:57:16.085 17990 17990 E AndroidRuntime:        at androidx.compose.runtime.ComposerImpl.doCompose(Composer.kt:3595)
02-05 11:57:16.085 17990 17990 E AndroidRuntime:        at androidx.compose.runtime.ComposerImpl.composeContent$runtime_release(Composer.kt:3522)
02-05 11:57:16.085 17990 17990 E AndroidRuntime:        at androidx.compose.runtime.CompositionImpl.composeContent(Composition.kt:743)
02-05 11:57:16.085 17990 17990 E AndroidRuntime:        at androidx.compose.runtime.Recomposer.composeInitial$runtime_release(Recomposer.kt:1122)
02-05 11:57:16.085 17990 17990 E AndroidRuntime:        at androidx.compose.runtime.CompositionImpl.composeInitial(Composition.kt:649)
02-05 11:57:16.085 17990 17990 E AndroidRuntime:        at androidx.compose.runtime.CompositionImpl.setContent(Composition.kt:635)
02-05 11:57:16.085 17990 17990 E AndroidRuntime:        at androidx.compose.ui.platform.WrappedComposition$setContent$1.invoke(Wrapper.android.kt:133)
02-05 11:57:16.085 17990 17990 E AndroidRuntime:        at androidx.compose.ui.platform.WrappedComposition$setContent$1.invoke(Wrapper.android.kt:124)
02-05 11:57:16.085 17990 17990 E AndroidRuntime:        at androidx.compose.ui.platform.AndroidComposeView.setOnViewTreeOwnersAvailable(AndroidComposeView.android.kt:1631)
02-05 11:57:16.085 17990 17990 E AndroidRuntime:        at androidx.compose.ui.platform.WrappedComposition.setContent(Wrapper.android.kt:124)
02-05 11:57:16.085 17990 17990 E AndroidRuntime:        at androidx.compose.ui.platform.WrappedComposition.onStateChanged(Wrapper.android.kt:180)
02-05 11:57:16.085 17990 17990 E AndroidRuntime:        at androidx.lifecycle.LifecycleRegistry$ObserverWithState.dispatchEvent(LifecycleRegistry.kt:314)
02-05 11:57:16.085 17990 17990 E AndroidRuntime:        at androidx.lifecycle.LifecycleRegistry.addObserver(LifecycleRegistry.kt:192)
02-05 11:57:16.085 17990 17990 E AndroidRuntime:        at androidx.compose.ui.platform.WrappedComposition$setContent$1.invoke(Wrapper.android.kt:131)
02-05 11:57:16.085 17990 17990 E AndroidRuntime:        at androidx.compose.ui.platform.WrappedComposition$setContent$1.invoke(Wrapper.android.kt:124)
02-05 11:57:16.085 17990 17990 E AndroidRuntime:        at androidx.compose.ui.platform.AndroidComposeView.onAttachedToWindow(AndroidComposeView.android.kt:1712)
02-05 11:57:16.085 17990 17990 E AndroidRuntime:        at android.view.View.dispatchAttachedToWindow(View.java:22479)
02-05 11:57:16.085 17990 17990 E AndroidRuntime:        at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3686)
02-05 11:57:16.085 17990 17990 E AndroidRuntime:        at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3695)
02-05 11:57:16.085 17990 17990 E AndroidRuntime:        at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3695)
02-05 11:57:16.085 17990 17990 E AndroidRuntime:        at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3695)
02-05 11:57:16.085 17990 17990 E AndroidRuntime:        at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3695)
02-05 11:57:16.085 17990 17990 E AndroidRuntime:        at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:3669)
02-05 11:57:16.085 17990 17990 E AndroidRuntime:        at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:3116)
02-05 11:57:16.085 17990 17990 E AndroidRuntime:        at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:10885)
02-05 11:57:16.085 17990 17990 E AndroidRuntime:        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1301)
02-05 11:57:16.085 17990 17990 E AndroidRuntime:        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1309)
02-05 11:57:16.085 17990 17990 E AndroidRuntime:        at android.view.Choreographer.doCallbacks(Choreographer.java:923)
02-05 11:57:16.085 17990 17990 E AndroidRuntime:        at android.view.Choreographer.doFrame(Choreographer.java:852)
02-05 11:57:16.085 17990 17990 E AndroidRuntime:        at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1283)
02-05 11:57:16.085 17990 17990 E AndroidRuntime:        at android.os.Handler.handleCallback(Handler.java:942)
02-05 11:57:16.085 17990 17990 E AndroidRuntime:        at android.os.Handler.dispatchMessage(Handler.java:99)
02-05 11:57:16.085 17990 17990 E AndroidRuntime:        at android.os.Looper.loopOnce(Looper.java:226)
02-05 11:57:16.085 17990 17990 E AndroidRuntime:        at android.os.Looper.loop(Looper.java:313)
02-05 11:57:16.085 17990 17990 E AndroidRuntime:        at android.app.ActivityThread.main(ActivityThread.java:8762)
02-05 11:57:16.086 17990 17990 E AndroidRuntime:        at java.lang.reflect.Method.invoke(Native Method)
02-05 11:57:16.086 17990 17990 E AndroidRuntime:        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:604)
02-05 11:57:16.086 17990 17990 E AndroidRuntime:        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)
02-05 11:57:16.086 17990 17990 E AndroidRuntime: Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.lifecycle.compose.LocalLifecycleOwnerKt" on path: DexPathList[[zip file "/data/app/~~nAFq-Wfo9cTNFm6g7XEk8g==/com.hi_fella-_FFA4cDXo-LVUEgwA1QSlQ==/base.apk"],nativeLibraryDirectories=[/data/app/~~nAFq-Wfo9cTNFm6g7XEk8g==/com.hi_fella-_FFA4cDXo-LVUEgwA1QSlQ==/lib/arm64, /data/app/~~nAFq-Wfo9cTNFm6g7XEk8g==/com.hi_fella-_FFA4cDXo-LVUEgwA1QSlQ==/base.apk!/lib/arm64-v8a, /system/lib64, /system/system_ext/lib64]]
02-05 11:57:16.086 17990 17990 E AndroidRuntime:        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:259)
02-05 11:57:16.086 17990 17990 E AndroidRuntime:        at java.lang.ClassLoader.loadClass(ClassLoader.java:637)
02-05 11:57:16.086 17990 17990 E AndroidRuntime:        at java.lang.ClassLoader.loadClass(ClassLoader.java:573)

Version

v3.3.0

What platforms are you seeing the problem on?

Android

System info

System:
    OS: Windows 11 10.0.26100
    CPU: (16) x64 13th Gen Intel(R) Core(TM) i7-13620H
    Memory: 2.20 GB / 15.63 GB
  Binaries:
    Node: 18.19.1 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.22 - ~\AppData\Roaming\nvm\v18.20.0\yarn.CMD
    npm: 10.2.4 - C:\Program Files\nodejs\npm.CMD
    Watchman: Not Found
  SDKs:
    Android SDK: Not Found
    Windows SDK: Not Found
  IDEs:
    Android Studio: AI-212.5712.43.2112.8815526
    Visual Studio: Not Found
  Languages:
    Java: 17.0.13
  npmPackages:
    @react-native-community/cli: Not Found
    react: 18.0.0 => 18.0.0
    react-native: 0.69.5 => 0.69.5
    react-native-windows: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions