java.lang.NoSuchMethodError: No virtual method at(Ljava/lang/Object;I)Landroidx/compose/animation/co

使用androidx.compose.material:material中pullRefresh控件刷新列表,遇到的问题记录:

下拉刷新后异步延时请求数据闪退:

java.lang.NoSuchMethodError: No virtual method at(Ljava/lang/Object;I)Landroidx/compose/animation/core/KeyframesSpec$KeyframeEntity; in class Landroidx/compose/animation/core/KeyframesSpec$KeyframesSpecConfig; or its super classes (declaration of 'androidx.compose.animation.core.KeyframesSpec$KeyframesSpecConfig' appears in /data/app/~~cT_YyVM5oo33ge2V3BX-qQ==/com.zxy.compose-IwoJF-BNmGroieBAnRJJkw==/base.apk)
    	at androidx.compose.material.ProgressIndicatorKt$CircularProgressIndicator$endAngle$2.invoke(ProgressIndicator.kt:369)
    	at androidx.compose.material.ProgressIndicatorKt$CircularProgressIndicator$endAngle$2.invoke(ProgressIndicator.kt:367)
    	at androidx.compose.animation.core.AnimationSpecKt.keyframes(AnimationSpec.kt:649)
    	at androidx.compose.material.ProgressIndicatorKt.CircularProgressIndicator-LxG7B9w(ProgressIndicator.kt:367)
    	at androidx.compose.material.pullrefresh.PullRefreshIndicatorKt$PullRefreshIndicator$1$1.invoke(PullRefreshIndicator.kt:104)
    	at androidx.compose.material.pullrefresh.PullRefreshIndicatorKt$PullRefreshIndicator$1$1.invoke(PullRefreshIndicator.kt:96)
    	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.animation.CrossfadeKt$Crossfade$5$1.invoke(Crossfade.kt:133)
    	at androidx.compose.animation.CrossfadeKt$Crossfade$5$1.invoke(Crossfade.kt:128)
    	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.animation.CrossfadeKt.Crossfade(Crossfade.kt:142)
    	at androidx.compose.animation.CrossfadeKt.Crossfade(Crossfade.kt:73)
    	at androidx.compose.material.pullrefresh.PullRefreshIndicatorKt$PullRefreshIndicator$1.invoke(PullRefreshIndicator.kt:93)
    	at androidx.compose.material.pullrefresh.PullRefreshIndicatorKt$PullRefreshIndicator$1.invoke(PullRefreshIndicator.kt:92)
    	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.material.SurfaceKt$Surface$1.invoke(Surface.kt:137)
    	at androidx.compose.material.SurfaceKt$Surface$1.invoke(Surface.kt:118)
    	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.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:228)
    	at androidx.compose.material.SurfaceKt.Surface-F-jzlyU(Surface.kt:115)
    	at androidx.compose.material.pullrefresh.PullRefreshIndicatorKt.PullRefreshIndicator-jB83MbM(PullRefreshIndicator.kt:85)
.........            

查询发现,我都引入了依赖:

implementation("androidx.compose.material3:material3")
implementation("androidx.compose.material:material")

报错的代码如下:

val endAngle by transition.animateFloat(
    0f,
    JumpRotationAngle,
    infiniteRepeatable(
        animation = keyframes {
            durationMillis = HeadAndTailAnimationDuration + HeadAndTailDelayDuration
            0f at 0 with CircularEasing
            JumpRotationAngle at HeadAndTailAnimationDuration
        }
    )
)

查询compose依赖版本,发现引入以下版本可以解决问题:

implementation("androidx.compose.material3:material3:1.2.0-rc01")

你可能感兴趣的:(compose,android,compose,闪退)