gpt4 book ai didi

android - 启动新的撰写项目时出错 java.lang.AbstractMethodError

转载 作者:行者123 更新时间:2023-12-04 13:51:59 27 4
gpt4 key购买 nike

我在 android studio bumblebee 2021.1.1 上工作,并在创建 compose 项目时出现此错误

java.lang.AbstractMethodError: abstract method "void androidx.lifecycle.DefaultLifecycleObserver.onCreate(androidx.lifecycle.LifecycleOwner)"
at androidx.lifecycle.FullLifecycleObserverAdapter.onStateChanged(FullLifecycleObserverAdapter.java:36)
at androidx.lifecycle.LifecycleRegistry$ObserverWithState.dispatchEvent(LifecycleRegistry.java:354)
at androidx.lifecycle.LifecycleRegistry.addObserver(LifecycleRegistry.java:196)
at androidx.compose.ui.platform.AndroidComposeView.onAttachedToWindow(AndroidComposeView.android.kt:808)
at android.view.View.dispatchAttachedToWindow(View.java:22010)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:4291)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:4298)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:4298)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:4298)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:4298)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:3135)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2618)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:9971)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1010)
at android.view.Choreographer.doCallbacks(Choreographer.java:809)
at android.view.Choreographer.doFrame(Choreographer.java:744)
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:8512)
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)
运行项目时发生错误。
我试图改变 ComponentActivityAppCompatActivity但同样的错误发生

更新
通过将 gradle 版本升级到 v7.1.1 解决了问题

最佳答案

就像 Gabriele Mariotti 已经评论过的那样,Android Gradle Plugin 7.1.0-alpha04 打破了从 Android Studio 开始 Compose 应用程序。您可以通过将应用程序的 Min SDK 版本设置为 24 或通过命令行将 Compose 应用程序安装到您的设备并在那里启动它来解决此问题。
或者您可以将 AGP 降级到 7.1.0-alpha03,但您还必须降级到 Android Studio Bumblebee 2021.1.1 Canary 3。

关于android - 启动新的撰写项目时出错 java.lang.AbstractMethodError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68486036/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com