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 LottieAnimation warning "Animation contains merge paths but they are disabled" even when enabledMergePaths true. #1970

Closed jasco closed 2 years ago

jasco commented 2 years ago

Using com.airbnb.android:lottie-compose:4.2.2.

Client composable code:

val composition by rememberLottieComposition(LottieCompositionSpec.Asset("myasset"))
LottieAnimation(
    modifier = modifier,
    composition = composition,
    enableMergePaths = true,
)

In logcat I observe the warning Animation contains merge paths but they are disabled.

Looking at the stacktrace, shown below, this occurs because LottieDrawable.setComposition is invoked before LottieDrawable.enableMergePathsForKitKatAndAbove has been called in LottieAnimation (invoke:95, LottieAnimationKt$LottieAnimation$2 (com.airbnb.lottie.compose)).

From what I can tell this is inconsequential because enableMergePathsForKitKatAndAbove calls buildCompositionLayer, which eventually calls through to MergePaths again, but on the surface it would appear that enabling the merge path before setting the composition might eliminate the warning as well as an extra call to buildCompositionLayer.

toContent:62, MergePaths (com.airbnb.lottie.model.content)
contentsFromModels:37, ContentGroup (com.airbnb.lottie.animation.content)
<init>:68, ContentGroup (com.airbnb.lottie.animation.content)
toContent:35, ShapeGroup (com.airbnb.lottie.model.content)
contentsFromModels:37, ContentGroup (com.airbnb.lottie.animation.content)
<init>:68, ContentGroup (com.airbnb.lottie.animation.content)
<init>:31, ShapeLayer (com.airbnb.lottie.model.layer)
forModel:58, BaseLayer (com.airbnb.lottie.model.layer)
<init>:56, CompositionLayer (com.airbnb.lottie.model.layer)
forModel:61, BaseLayer (com.airbnb.lottie.model.layer)
<init>:56, CompositionLayer (com.airbnb.lottie.model.layer)
buildCompositionLayer:318, LottieDrawable (com.airbnb.lottie)
setComposition:217, LottieDrawable (com.airbnb.lottie)
invoke:95, LottieAnimationKt$LottieAnimation$2 (com.airbnb.lottie.compose)
invoke:80, LottieAnimationKt$LottieAnimation$2 (com.airbnb.lottie.compose)
draw:101, DrawBackgroundModifier (androidx.compose.ui.draw)
performDraw:102, ModifiedDrawNode (androidx.compose.ui.node)
draw:244, LayoutNodeWrapper (androidx.compose.ui.node)
performDraw:98, ModifiedLayoutNode (androidx.compose.ui.node)
draw:244, LayoutNodeWrapper (androidx.compose.ui.node)
performDraw:68, DelegatingLayoutNodeWrapper (androidx.compose.ui.node)
draw:244, LayoutNodeWrapper (androidx.compose.ui.node)
performDraw:98, ModifiedLayoutNode (androidx.compose.ui.node)
draw:244, LayoutNodeWrapper (androidx.compose.ui.node)
draw$ui_release:814, LayoutNode (androidx.compose.ui.node)
performDraw:105, InnerPlaceable (androidx.compose.ui.node)
draw:244, LayoutNodeWrapper (androidx.compose.ui.node)
performDraw:68, DelegatingLayoutNodeWrapper (androidx.compose.ui.node)
draw:244, LayoutNodeWrapper (androidx.compose.ui.node)
performDraw:98, ModifiedLayoutNode (androidx.compose.ui.node)
draw:244, LayoutNodeWrapper (androidx.compose.ui.node)
draw$ui_release:814, LayoutNode (androidx.compose.ui.node)
performDraw:105, InnerPlaceable (androidx.compose.ui.node)
draw:244, LayoutNodeWrapper (androidx.compose.ui.node)
draw$ui_release:814, LayoutNode (androidx.compose.ui.node)
performDraw:105, InnerPlaceable (androidx.compose.ui.node)
draw:244, LayoutNodeWrapper (androidx.compose.ui.node)
performDraw:98, ModifiedLayoutNode (androidx.compose.ui.node)
draw:244, LayoutNodeWrapper (androidx.compose.ui.node)
performDraw:98, ModifiedLayoutNode (androidx.compose.ui.node)
draw:244, LayoutNodeWrapper (androidx.compose.ui.node)
performDraw:68, DelegatingLayoutNodeWrapper (androidx.compose.ui.node)
invoke:255, LayoutNodeWrapper$invoke$1 (androidx.compose.ui.node)
invoke:254, LayoutNodeWrapper$invoke$1 (androidx.compose.ui.node)
observeReads:128, SnapshotStateObserver (androidx.compose.runtime.snapshots)
observeReads$ui_release:75, OwnerSnapshotObserver (androidx.compose.ui.node)
invoke:254, LayoutNodeWrapper (androidx.compose.ui.node)
invoke:54, LayoutNodeWrapper (androidx.compose.ui.node)
record:156, RenderNodeApi29 (androidx.compose.ui.platform)
updateDisplayList:243, RenderNodeLayer (androidx.compose.ui.platform)
drawLayer:224, RenderNodeLayer (androidx.compose.ui.platform)
draw:239, LayoutNodeWrapper (androidx.compose.ui.node)
draw$ui_release:814, LayoutNode (androidx.compose.ui.node)
performDraw:105, InnerPlaceable (androidx.compose.ui.node)
draw:244, LayoutNodeWrapper (androidx.compose.ui.node)
performDraw:98, ModifiedLayoutNode (androidx.compose.ui.node)
invoke:255, LayoutNodeWrapper$invoke$1 (androidx.compose.ui.node)
invoke:254, LayoutNodeWrapper$invoke$1 (androidx.compose.ui.node)
observeReads:128, SnapshotStateObserver (androidx.compose.runtime.snapshots)
observeReads$ui_release:75, OwnerSnapshotObserver (androidx.compose.ui.node)
invoke:254, LayoutNodeWrapper (androidx.compose.ui.node)
invoke:54, LayoutNodeWrapper (androidx.compose.ui.node)
record:156, RenderNodeApi29 (androidx.compose.ui.platform)
updateDisplayList:243, RenderNodeLayer (androidx.compose.ui.platform)
drawLayer:224, RenderNodeLayer (androidx.compose.ui.platform)
draw:239, LayoutNodeWrapper (androidx.compose.ui.node)
performDraw:98, ModifiedLayoutNode (androidx.compose.ui.node)
draw:244, LayoutNodeWrapper (androidx.compose.ui.node)
performDraw:68, DelegatingLayoutNodeWrapper (androidx.compose.ui.node)
draw:244, LayoutNodeWrapper (androidx.compose.ui.node)
performDraw:68, DelegatingLayoutNodeWrapper (androidx.compose.ui.node)
draw:244, LayoutNodeWrapper (androidx.compose.ui.node)
performDraw:68, DelegatingLayoutNodeWrapper (androidx.compose.ui.node)
draw:244, LayoutNodeWrapper (androidx.compose.ui.node)
performDraw:68, DelegatingLayoutNodeWrapper (androidx.compose.ui.node)
draw:244, LayoutNodeWrapper (androidx.compose.ui.node)
performDraw:68, DelegatingLayoutNodeWrapper (androidx.compose.ui.node)
draw:244, LayoutNodeWrapper (androidx.compose.ui.node)
draw$ui_release:814, LayoutNode (androidx.compose.ui.node)
performDraw:105, InnerPlaceable (androidx.compose.ui.node)
draw:244, LayoutNodeWrapper (androidx.compose.ui.node)
performDraw:98, ModifiedLayoutNode (androidx.compose.ui.node)
draw:244, LayoutNodeWrapper (androidx.compose.ui.node)
draw$ui_release:814, LayoutNode (androidx.compose.ui.node)
performDraw:105, InnerPlaceable (androidx.compose.ui.node)
draw:244, LayoutNodeWrapper (androidx.compose.ui.node)
performDraw:68, DelegatingLayoutNodeWrapper (androidx.compose.ui.node)
draw:244, LayoutNodeWrapper (androidx.compose.ui.node)
performDraw:68, DelegatingLayoutNodeWrapper (androidx.compose.ui.node)
invoke:255, LayoutNodeWrapper$invoke$1 (androidx.compose.ui.node)
invoke:254, LayoutNodeWrapper$invoke$1 (androidx.compose.ui.node)
observe:115, Snapshot$Companion (androidx.compose.runtime.snapshots)
observeReads:123, SnapshotStateObserver (androidx.compose.runtime.snapshots)
observeReads$ui_release:75, OwnerSnapshotObserver (androidx.compose.ui.node)
invoke:254, LayoutNodeWrapper (androidx.compose.ui.node)
invoke:54, LayoutNodeWrapper (androidx.compose.ui.node)
record:156, RenderNodeApi29 (androidx.compose.ui.platform)
updateDisplayList:243, RenderNodeLayer (androidx.compose.ui.platform)
dispatchDraw:677, AndroidComposeView (androidx.compose.ui.platform)
draw:22353, View (android.view)
updateDisplayListIfDirty:21226, View (android.view)
recreateChildDisplayList:4500, ViewGroup (android.view)
dispatchGetDisplayList:4473, ViewGroup (android.view)
updateDisplayListIfDirty:21186, View (android.view)
recreateChildDisplayList:4500, ViewGroup (android.view)
dispatchGetDisplayList:4473, ViewGroup (android.view)
updateDisplayListIfDirty:21186, View (android.view)
recreateChildDisplayList:4500, ViewGroup (android.view)
dispatchGetDisplayList:4473, ViewGroup (android.view)
updateDisplayListIfDirty:21186, View (android.view)
recreateChildDisplayList:4500, ViewGroup (android.view)
dispatchGetDisplayList:4473, ViewGroup (android.view)
updateDisplayListIfDirty:21186, View (android.view)
updateViewTreeDisplayList:559, ThreadedRenderer (android.view)
updateRootDisplayList:565, ThreadedRenderer (android.view)
draw:642, ThreadedRenderer (android.view)
draw:4101, ViewRootImpl (android.view)
performDraw:3828, ViewRootImpl (android.view)
performTraversals:3099, ViewRootImpl (android.view)
doTraversal:1952, ViewRootImpl (android.view)
run:8171, ViewRootImpl$TraversalRunnable (android.view)
run:972, Choreographer$CallbackRecord (android.view)
doCallbacks:796, Choreographer (android.view)
doFrame:731, Choreographer (android.view)
run:957, Choreographer$FrameDisplayEventReceiver (android.view)
handleCallback:938, Handler (android.os)
dispatchMessage:99, Handler (android.os)
loop:223, Looper (android.os)
main:7656, ActivityThread (android.app)
invoke:-1, Method (java.lang.reflect)
run:592, RuntimeInit$MethodAndArgsCaller (com.android.internal.os)
main:947, ZygoteInit (com.android.internal.os)
andremion commented 10 months ago

This still happens in the 6.3.0 version