5

I'm starting in Android Jetpack Compose. I installed Canary, when I create an Empty Compose Activity and run it without changes (Hello Android!) I have the next error:

    Process: com.example.jetpacktest2, PID: 24788
    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:19855)
        at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3597)
        at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3604)
        at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3604)
        at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3604)
        at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3604)
        at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2376)
        at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1993)
        at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:8459)
        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1256)
        at android.view.Choreographer.doCallbacks(Choreographer.java:995)
        at android.view.Choreographer.doFrame(Choreographer.java:887)
        at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1224)
        at android.os.Handler.handleCallback(Handler.java:900)
        at android.os.Handler.dispatchMessage(Handler.java:103)
        at android.os.Looper.loop(Looper.java:219)
        at android.app.ActivityThread.main(ActivityThread.java:8387)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1055)

I didn't modify anything, it is the base code created by Android. Any help is appreciated.

PS: I load others codes made it on Android Studio (Without compose) and it run without errors.

Vadik Sirekanyan
  • 3,332
  • 1
  • 22
  • 29
Rafael Vidal
  • 123
  • 10

1 Answers1

0

I have the same issue. It is the issue of android studio canary build. It is one of the kind of bug of Canary build. So its fix is easy and simple.

Do these steps:

  1. Uninstall the canary Android Studio.

  2. Download the latest Android Studio Release Candidate (2020.3.1 RC 1)

    link: https://developer.android.com/studio/preview

enter image description here

  1. It will now work fine as previously. I fixed my problem the same as this. It will work 100% gurrantee.
Nafis Kabbo
  • 568
  • 5
  • 8
  • 3
    Thank you, I already fixed it updating compose_version to 1.0.0-rc02 and minSDK to 24, but I will keep it in mind for future issues. – Rafael Vidal Jul 27 '21 at 05:54