java.lang.NoSuchFieldError: 类中没有 I 型字段 $stable

And*_*mon 1 android android-fragments material-design android-jetpack-compose

尝试导航到使用 Material Motion 的 Fragment 时,我收到以下错误。

使用的版本:

  • 科特林 1.5.10
  • 撰写测试版 09
  • 材料 1.4.0-rc01
  • 片段 1.3.5
  • AGP 7.0.0-beta03(必须等待 Dagger 修复)
  • 伴奏 0.11.1
java.lang.NoSuchFieldError: No field $stable of type I in class Landroidx/compose/animation/core/Transition; or its superclasses (declaration of 'androidx.compose.animation.core.Transition' appears in /data/app/~~NMhx8f3SifgkfcXt9VHSKg==/app.tempory.debug-ZA5ilk8Gd0enqUNaUHOpCg==/base.apk)
        at com.google.accompanist.imageloading.MaterialLoadingImage.updateFadeInTransition(MaterialLoadingImage.kt:53)
        at com.google.accompanist.imageloading.LoadPainterKt.animateFadeInColorFilter(LoadPainter.kt:382)
        at com.google.accompanist.imageloading.LoadPainterKt.access$animateFadeInColorFilter(LoadPainter.kt:1)
        at com.google.accompanist.imageloading.LoadPainterKt$animateFadeInColorFilter$3.invoke(Unknown Source:10)
        at com.google.accompanist.imageloading.LoadPainterKt$animateFadeInColorFilter$3.invoke(Unknown Source:10)
        at androidx.compose.runtime.RecomposeScopeImpl.compose(RecomposeScopeImpl.kt:140)
        at androidx.compose.runtime.ComposerImpl.recomposeToGroupEnd(Composer.kt:2156)
        at androidx.compose.runtime.ComposerImpl.skipCurrentGroup(Composer.kt:2399)
        at androidx.compose.runtime.ComposerImpl$doCompose$2$5.invoke(Composer.kt:2578)
        at androidx.compose.runtime.ComposerImpl$doCompose$2$5.invoke(Composer.kt:2571)
        at androidx.compose.runtime.SnapshotStateKt.observeDerivedStateRecalculations(SnapshotState.kt:523)
        at androidx.compose.runtime.ComposerImpl.doCompose(Composer.kt:2564)
        at androidx.compose.runtime.ComposerImpl.recompose$runtime_release(Composer.kt:2540)
        at androidx.compose.runtime.CompositionImpl.recompose(Composition.kt:613)
        at androidx.compose.runtime.Recomposer.performRecompose(Recomposer.kt:764)
        at androidx.compose.runtime.Recomposer.access$performRecompose(Recomposer.kt:103)
        at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$2.invoke(Recomposer.kt:447)
        at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$2.invoke(Recomposer.kt:416)
        at androidx.compose.ui.platform.AndroidUiFrameClock$withFrameNanos$2$callback$1.doFrame(AndroidUiFrameClock.android.kt:34)
        at androidx.compose.ui.platform.AndroidUiDispatcher.performFrameDispatch(AndroidUiDispatcher.android.kt:109)
        at androidx.compose.ui.platform.AndroidUiDispatcher.access$performFrameDispatch(AndroidUiDispatcher.android.kt:41)
        at androidx.compose.ui.platform.AndroidUiDispatcher$dispatchCallback$1.doFrame(AndroidUiDispatcher.android.kt:69)
        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:970)
        at android.view.Choreographer.doCallbacks(Choreographer.java:796)
        at android.view.Choreographer.doFrame(Choreographer.java:727)
        at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:957)
        at android.os.Handler.handleCallback(Handler.java:938)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:223)
        at android.app.ActivityThread.main(ActivityThread.java:7664)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
Run Code Online (Sandbox Code Playgroud)

And*_*mon 5

在这种情况下,我忘记将伴奏更新到正确的版本 (0.12.0)。


小智 5

这不是OP的问题,但对于像我这样在搜索中绊倒的人来说,如果您编辑一个类以使其处于@Immutable撰写状态,则可能会出现类似的错误消息。这是一个编译器缓存错误,只需Build -> Rebuild从 Android Studio 菜单中执行即可修复它。