aakarshrestha / compose-pager-snap-helper

ComposePagerSnapHelper library that works just like PagerSnapHelper for recyclerview.
MIT License
45 stars 5 forks source link

Crash with using Jetpack Compose 1.1.0-beta03 #5

Open Matej-Hlatky opened 2 years ago

Matej-Hlatky commented 2 years ago

Hi, when using com .github.aakarshrestha:compose-pager-snap-helper:0.4.1 with Jetpack Compose 1.1.0-beta03, app crashes with this error:

java.lang.NoSuchMethodError: No interface method startRestartGroup(ILjava/lang/String;)Landroidx/compose/runtime/Composer; in class Landroidx/compose/runtime/Composer; or its super classes (declaration of 'androidx.compose.runtime.Composer' appears in /data/app/~~VY74LRY6_pFhDunCNLRm0Q==/com.app-eqeSET1GcSLHkif4D6Deng==/base.apk)

Error log:

E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.app, PID: 6502
    java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:612)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
     Caused by: java.lang.reflect.InvocationTargetException
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130) 
     Caused by: java.lang.ClassNotFoundException: Composable Method 'com.app.CardsFragmentKt.CardsFragmentContentPreview' not found
        at androidx.compose.ui.tooling.CommonPreviewUtils.invokeComposableViaReflection$ui_tooling_release(CommonPreviewUtils.kt:197)
        at androidx.compose.ui.tooling.PreviewActivity$setComposableContent$2.invoke(PreviewActivity.kt:72)
        at androidx.compose.ui.tooling.PreviewActivity$setComposableContent$2.invoke(PreviewActivity.kt:71)
        at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)
        at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
        at androidx.compose.ui.platform.ComposeView.Content(ComposeView.android.kt:410)
        at androidx.compose.ui.platform.AbstractComposeView$ensureCompositionCreated$1.invoke(ComposeView.android.kt:252)
        at androidx.compose.ui.platform.AbstractComposeView$ensureCompositionCreated$1.invoke(ComposeView.android.kt:251)
        at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)
        at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
        at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:228)
        at androidx.compose.ui.platform.CompositionLocalsKt.ProvideCommonCompositionLocals(CompositionLocals.kt:166)
        at androidx.compose.ui.platform.AndroidCompositionLocals_androidKt$ProvideAndroidCompositionLocals$3.invoke(AndroidCompositionLocals.android.kt:123)
        at androidx.compose.ui.platform.AndroidCompositionLocals_androidKt$ProvideAndroidCompositionLocals$3.invoke(AndroidCompositionLocals.android.kt:122)
        at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)
        at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
        at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:228)
        at androidx.compose.ui.platform.AndroidCompositionLocals_androidKt.ProvideAndroidCompositionLocals(AndroidCompositionLocals.android.kt:114)
        at androidx.compose.ui.platform.WrappedComposition$setContent$1$1$3.invoke(Wrapper.android.kt:157)
        at androidx.compose.ui.platform.WrappedComposition$setContent$1$1$3.invoke(Wrapper.android.kt:156)
        at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)
        at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
        at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:228)
        at androidx.compose.ui.platform.WrappedComposition$setContent$1$1.invoke(Wrapper.android.kt:156)
        at androidx.compose.ui.platform.WrappedComposition$setContent$1$1.invoke(Wrapper.android.kt:140)
        at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)
        at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
        at androidx.compose.runtime.ComposerKt.invokeComposable(Composer.kt:3337)
        at androidx.compose.runtime.ComposerImpl$doCompose$2$5.invoke(Composer.kt:2582)
        at androidx.compose.runtime.ComposerImpl$doCompose$2$5.invoke(Composer.kt:2571)
        at androidx.compose.runtime.SnapshotStateKt__DerivedStateKt.observeDerivedStateRecalculations(DerivedState.kt:234)
        at androidx.compose.runtime.SnapshotStateKt.observeDerivedStateRecalculations(Unknown Source:1)
        at androidx.compose.runtime.ComposerImpl.doCompose(Composer.kt:2571)
E/AndroidRuntime:     at androidx.compose.runtime.ComposerImpl.composeContent$runtime_release(Composer.kt:2522)
        at androidx.compose.runtime.CompositionImpl.composeContent(Composition.kt:478)
        at androidx.compose.runtime.Recomposer.composeInitial$runtime_release(Recomposer.kt:748)
        at androidx.compose.runtime.CompositionImpl.setContent(Composition.kt:433)
        at androidx.compose.ui.platform.WrappedComposition$setContent$1.invoke(Wrapper.android.kt:140)
        at androidx.compose.ui.platform.WrappedComposition$setContent$1.invoke(Wrapper.android.kt:131)
        at androidx.compose.ui.platform.AndroidComposeView.setOnViewTreeOwnersAvailable(AndroidComposeView.android.kt:897)
        at androidx.compose.ui.platform.WrappedComposition.setContent(Wrapper.android.kt:131)
        at androidx.compose.ui.platform.WrappedComposition.onStateChanged(Wrapper.android.kt:182)
        at androidx.lifecycle.LifecycleRegistry$ObserverWithState.dispatchEvent(LifecycleRegistry.java:354)
        at androidx.lifecycle.LifecycleRegistry.addObserver(LifecycleRegistry.java:196)
        at androidx.compose.ui.platform.WrappedComposition$setContent$1.invoke(Wrapper.android.kt:138)
        at androidx.compose.ui.platform.WrappedComposition$setContent$1.invoke(Wrapper.android.kt:131)
        at androidx.compose.ui.platform.AndroidComposeView.onAttachedToWindow(AndroidComposeView.android.kt:984)
        at android.view.View.dispatchAttachedToWindow(View.java:22010)
        at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:4291)
        at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:4298)
        at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:4298)
        at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:4298)
        at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:4298)
        at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:3135)
        at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2618)
        at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:9971)
        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1010)
        at android.view.Choreographer.doCallbacks(Choreographer.java:809)
        at android.view.Choreographer.doFrame(Choreographer.java:744)
        at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:995)
        at android.os.Handler.handleCallback(Handler.java:938)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:246)
        at android.app.ActivityThread.main(ActivityThread.java:8653)
            ... 3 more
     Caused by: java.lang.reflect.InvocationTargetException
        at java.lang.reflect.Method.invoke(Native Method)
        at androidx.compose.ui.tooling.CommonPreviewUtils.invokeComposableMethod(CommonPreviewUtils.kt:150)
        at androidx.compose.ui.tooling.CommonPreviewUtils.invokeComposableViaReflection$ui_tooling_release(CommonPreviewUtils.kt:189)
            ... 66 more
     Caused by: java.lang.NoSuchMethodError: No interface method startRestartGroup(ILjava/lang/String;)Landroidx/compose/runtime/Composer; in class Landroidx/compose/runtime/Composer; or its super classes (declaration of 'androidx.compose.runtime.Composer' appears in /data/app/~~VY74LRY6_pFhDunCNLRm0Q==/com.app-eqeSET1GcSLHkif4D6Deng==/base.apk)
        at com.aakarshrestha.composepagersnaphelper.ComposePagerSnapHelperKt.ComposePagerSnapHelper-kHDZbjc(ComposePagerSnapHelper.kt:115)
        at com.app.ComposableSingletons$CardsFragmentKt$lambda-2$1.invoke(CardsFragment.kt:125)
        at com.app.ComposableSingletons$CardsFragmentKt$lambda-2$1.invoke(CardsFragment.kt:121)

When copy-pasted ComposePagerSnapHelper into app source code, it works well. So the fix would be to just re-compile against latest Jetpack Compose 1.1.0-beta03.

aakarshrestha commented 2 years ago

Hi,

Upgrade compose version to latest version. At the moment, latest version is 1.0.1

Thanks!

On Thu, Dec 9, 2021 at 4:24 AM Matej Hlatký @.***> wrote:

Hi, when using com .github.aakarshrestha:compose-pager-snap-helper:0.4.1 with Jetpack Compose 1.1.0-beta03, app crashes with this error:

java.lang.NoSuchMethodError: No interface method startRestartGroup(ILjava/lang/String;)Landroidx/compose/runtime/Composer; in class Landroidx/compose/runtime/Composer; or its super classes (declaration of 'androidx.compose.runtime.Composer' appears in /data/app/~~VY74LRY6_pFhDunCNLRm0Q==/com.app-eqeSET1GcSLHkif4D6Deng==/base.apk)

Error log:

E/AndroidRuntime: FATAL EXCEPTION: main

Process: com.app, PID: 6502

java.lang.RuntimeException: java.lang.reflect.InvocationTargetException

    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:612)

    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)

 Caused by: java.lang.reflect.InvocationTargetException

    at java.lang.reflect.Method.invoke(Native Method)

    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)

    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)

 Caused by: java.lang.ClassNotFoundException: Composable Method 'com.app.CardsFragmentKt.CardsFragmentContentPreview' not found

    at androidx.compose.ui.tooling.CommonPreviewUtils.invokeComposableViaReflection$ui_tooling_release(CommonPreviewUtils.kt:197)

    at androidx.compose.ui.tooling.PreviewActivity$setComposableContent$2.invoke(PreviewActivity.kt:72)

    at androidx.compose.ui.tooling.PreviewActivity$setComposableContent$2.invoke(PreviewActivity.kt:71)

    at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)

    at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)

    at androidx.compose.ui.platform.ComposeView.Content(ComposeView.android.kt:410)

    at androidx.compose.ui.platform.AbstractComposeView$ensureCompositionCreated$1.invoke(ComposeView.android.kt:252)

    at androidx.compose.ui.platform.AbstractComposeView$ensureCompositionCreated$1.invoke(ComposeView.android.kt:251)

    at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)

    at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)

    at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:228)

    at androidx.compose.ui.platform.CompositionLocalsKt.ProvideCommonCompositionLocals(CompositionLocals.kt:166)

    at androidx.compose.ui.platform.AndroidCompositionLocals_androidKt$ProvideAndroidCompositionLocals$3.invoke(AndroidCompositionLocals.android.kt:123)

    at androidx.compose.ui.platform.AndroidCompositionLocals_androidKt$ProvideAndroidCompositionLocals$3.invoke(AndroidCompositionLocals.android.kt:122)

    at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)

    at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)

    at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:228)

    at androidx.compose.ui.platform.AndroidCompositionLocals_androidKt.ProvideAndroidCompositionLocals(AndroidCompositionLocals.android.kt:114)

    at androidx.compose.ui.platform.WrappedComposition$setContent$1$1$3.invoke(Wrapper.android.kt:157)

    at androidx.compose.ui.platform.WrappedComposition$setContent$1$1$3.invoke(Wrapper.android.kt:156)

    at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)

    at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)

    at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:228)

    at androidx.compose.ui.platform.WrappedComposition$setContent$1$1.invoke(Wrapper.android.kt:156)

    at androidx.compose.ui.platform.WrappedComposition$setContent$1$1.invoke(Wrapper.android.kt:140)

    at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)

    at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)

    at androidx.compose.runtime.ComposerKt.invokeComposable(Composer.kt:3337)

    at androidx.compose.runtime.ComposerImpl$doCompose$2$5.invoke(Composer.kt:2582)

    at androidx.compose.runtime.ComposerImpl$doCompose$2$5.invoke(Composer.kt:2571)

    at androidx.compose.runtime.SnapshotStateKt__DerivedStateKt.observeDerivedStateRecalculations(DerivedState.kt:234)

    at androidx.compose.runtime.SnapshotStateKt.observeDerivedStateRecalculations(Unknown Source:1)

    at androidx.compose.runtime.ComposerImpl.doCompose(Composer.kt:2571)

E/AndroidRuntime: at androidx.compose.runtime.ComposerImpl.composeContent$runtime_release(Composer.kt:2522)

    at androidx.compose.runtime.CompositionImpl.composeContent(Composition.kt:478)

    at androidx.compose.runtime.Recomposer.composeInitial$runtime_release(Recomposer.kt:748)

    at androidx.compose.runtime.CompositionImpl.setContent(Composition.kt:433)

    at androidx.compose.ui.platform.WrappedComposition$setContent$1.invoke(Wrapper.android.kt:140)

    at androidx.compose.ui.platform.WrappedComposition$setContent$1.invoke(Wrapper.android.kt:131)

    at androidx.compose.ui.platform.AndroidComposeView.setOnViewTreeOwnersAvailable(AndroidComposeView.android.kt:897)

    at androidx.compose.ui.platform.WrappedComposition.setContent(Wrapper.android.kt:131)

    at androidx.compose.ui.platform.WrappedComposition.onStateChanged(Wrapper.android.kt:182)

    at androidx.lifecycle.LifecycleRegistry$ObserverWithState.dispatchEvent(LifecycleRegistry.java:354)

    at androidx.lifecycle.LifecycleRegistry.addObserver(LifecycleRegistry.java:196)

    at androidx.compose.ui.platform.WrappedComposition$setContent$1.invoke(Wrapper.android.kt:138)

    at androidx.compose.ui.platform.WrappedComposition$setContent$1.invoke(Wrapper.android.kt:131)

    at androidx.compose.ui.platform.AndroidComposeView.onAttachedToWindow(AndroidComposeView.android.kt:984)

    at android.view.View.dispatchAttachedToWindow(View.java:22010)

    at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:4291)

    at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:4298)

    at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:4298)

    at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:4298)

    at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:4298)

    at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:3135)

    at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2618)

    at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:9971)

    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1010)

    at android.view.Choreographer.doCallbacks(Choreographer.java:809)

    at android.view.Choreographer.doFrame(Choreographer.java:744)

    at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:995)

    at android.os.Handler.handleCallback(Handler.java:938)

    at android.os.Handler.dispatchMessage(Handler.java:99)

    at android.os.Looper.loop(Looper.java:246)

    at android.app.ActivityThread.main(ActivityThread.java:8653)

      ... 3 more

 Caused by: java.lang.reflect.InvocationTargetException

    at java.lang.reflect.Method.invoke(Native Method)

    at androidx.compose.ui.tooling.CommonPreviewUtils.invokeComposableMethod(CommonPreviewUtils.kt:150)

    at androidx.compose.ui.tooling.CommonPreviewUtils.invokeComposableViaReflection$ui_tooling_release(CommonPreviewUtils.kt:189)

      ... 66 more

 Caused by: java.lang.NoSuchMethodError: No interface method startRestartGroup(ILjava/lang/String;)Landroidx/compose/runtime/Composer; in class Landroidx/compose/runtime/Composer; or its super classes (declaration of 'androidx.compose.runtime.Composer' appears in /data/app/~~VY74LRY6_pFhDunCNLRm0Q==/com.app-eqeSET1GcSLHkif4D6Deng==/base.apk)

    at com.aakarshrestha.composepagersnaphelper.ComposePagerSnapHelperKt.ComposePagerSnapHelper-kHDZbjc(ComposePagerSnapHelper.kt:115)

    at com.app.ComposableSingletons$CardsFragmentKt$lambda-2$1.invoke(CardsFragment.kt:125)

    at com.app.ComposableSingletons$CardsFragmentKt$lambda-2$1.invoke(CardsFragment.kt:121)

When copy-pasted ComposePagerSnapHelper into app source code, it works well. So the fix would be to just re-compile against latest Jetpack Compose 1.1.0-beta03.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/aakarshrestha/compose-pager-snap-helper/issues/5, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADS4P3PEVETO27HAJFY2QB3UQB7VVANCNFSM5JWCVVUQ .