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

文章讲述了开发者在使用AndroidXComposeMaterial的PullRefresh控件时遇到的`NoSuchMethodError`,涉及到动画关键帧方法缺失,以及通过升级material3到特定版本1.2.0-rc01来解决问题的过程。
摘要由CSDN通过智能技术生成

使用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")

  • 23
    点赞
  • 21
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值