airbnb / lottie-android

Render After Effects animations natively on Android and iOS, Web, and React Native
http://airbnb.io/lottie/
Apache License 2.0
35.02k stars 5.41k forks source link

compose-v5.2.0 crash #2118

Closed uty3714 closed 2 years ago

uty3714 commented 2 years ago

hi, When I was using compose version 5.2.5, I turned on the obfuscation rule of release, and the following abnormal information was reproduced with a high probability for the first time.

carsh:

java.lang.ClassCastException: androidx.compose.ui.CombinedModifier cannot be cast to androidx.compose.runtime.RecomposeScopeImpl
        at androidx.compose.runtime.ComposerImpl.addRecomposeScope(SourceFile:11)
        at androidx.compose.runtime.ComposerImpl.startRestartGroup(SourceFile:2)
        at androidx.compose.foundation.layout.BoxKt.Box(SourceFile:36)
        at com.airbnb.lottie.compose.LottieAnimationKt.LottieAnimation(SourceFile:35)
        at packagename.MainHomeScreen(SourceFile:211)
        at packagename.MainHomeScreenKt$MainHomeScreen$2.invoke(Unknown Source:10)
        at packagename.MainHomeScreenKt$MainHomeScreen$2.invoke(Unknown Source:8)
        at androidx.compose.runtime.RecomposeScopeImpl.compose(Unknown Source:14)
        at androidx.compose.runtime.ComposerImpl.recomposeToGroupEnd(SourceFile:19)
        at androidx.compose.runtime.ComposerImpl.skipCurrentGroup(SourceFile:9)
        at androidx.compose.runtime.ComposerImpl$doCompose$2$5.invoke(SourceFile:12)
        at androidx.compose.runtime.ComposerImpl$doCompose$2$5.invoke(SourceFile:1)
        at androidx.compose.runtime.SnapshotStateKt__DerivedStateKt.observeDerivedStateRecalculations(SourceFile:6)
        at androidx.compose.runtime.SnapshotStateKt.observeDerivedStateRecalculations(Unknown Source:0)
        at androidx.compose.runtime.ComposerImpl.doCompose(SourceFile:19)
        at androidx.compose.runtime.ComposerImpl.recompose$runtime_release(SourceFile:5)
        at androidx.compose.runtime.CompositionImpl.recompose(SourceFile:4)
        at androidx.compose.runtime.Recomposer.performRecompose(SourceFile:8)
        at androidx.compose.runtime.Recomposer.access$performRecompose(Unknown Source:0)
        at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$2.invoke(SourceFile:51)
        at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$2.invoke(SourceFile:1)
        at androidx.compose.ui.platform.AndroidUiFrameClock$withFrameNanos$2$callback$1.doFrame(Unknown Source:10)
        at androidx.compose.ui.platform.AndroidUiDispatcher.performFrameDispatch(SourceFile:10)
        at androidx.compose.ui.platform.AndroidUiDispatcher.access$performFrameDispatch(Unknown Source:0)
        at androidx.compose.ui.platform.AndroidUiDispatcher$dispatchCallback$1.doFrame(SourceFile:3)
        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1008)
        at android.view.Choreographer.doCallbacks(Choreographer.java:809)
        at android.view.Choreographer.doFrame(Choreographer.java:740)
        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:8633)
        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)
        Suppressed: kotlinx.coroutines.DiagnosticCoroutineContextException: [androidx.compose.runtime.PausableMonotonicFrameClock@a6f2727, androidx.compose.ui.platform.MotionDurationScaleImpl@e6bbdd4, vv1{Cancelling}@dae9b7d, AndroidUiDispatcher@6667a72]

code:

 val lottieComposition by rememberLottieComposition(spec = LottieCompositionSpec.Asset("lottie/home/data.json"))
    val lottieProgress by animateLottieCompositionAsState(
        composition = lottieComposition,
        isPlaying = true,
        iterations = LottieConstants.IterateForever,
        restartOnPlay = false,
        speed = 1.0f
    )

  LottieAnimation(
                        modifier = Modifier.size(size = 300.dp),
                        composition = lottieComposition,
                        progress = {lottieProgress}
                    )

proguard-rules:

# class LottieAnimation
-keep class com.airbnb.lottie.** {*;}
-keep class androidx.compose.** {*;}
uty3714 commented 2 years ago

can you help me? thanks

gpeal commented 2 years ago

Can you attach a sample project that reproduces this?

gpeal commented 2 years ago

Closing due to lack of activity. Feel free to reopen with a sample project.