Android IDE (AIDE) Support Forum

Viewpager2 crashes my application

I’m trying to add viewpager2 in my application, added dependency successfully, but it crashes at runtime,

LOGS==> FATAL EXCEPTION: main
01-22 15:25:50.227 19984 19984 E AndroidRuntime Process: com.mycompany.myapp, PID: 19984
01-22 15:25:50.227 19984 19984 E AndroidRuntime java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/lifecycle/LifecycleEventObserver;
01-22 15:25:50.227 19984 19984 E AndroidRuntime at java.lang.Class.newInstance(Native Method)
01-22 15:25:50.227 19984 19984 E AndroidRuntime at android.app.AppComponentFactory.instantiateActivity(AppComponentFactory.java:95)
01-22 15:25:50.227 19984 19984 E AndroidRuntime at androidx.core.app.CoreComponentFactory.instantiateActivity(CoreComponentFactory.java:43)
01-22 15:25:50.227 19984 19984 E AndroidRuntime at android.app.Instrumentation.newActivity(Instrumentation.java:1279)
01-22 15:25:50.227 19984 19984 E AndroidRuntime at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3532)
01-22 15:25:50.227 19984 19984 E AndroidRuntime at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3792)
01-22 15:25:50.227 19984 19984 E AndroidRuntime at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103)
01-22 15:25:50.227 19984 19984 E AndroidRuntime at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
01-22 15:25:50.227 19984 19984 E AndroidRuntime at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
01-22 15:25:50.227 19984 19984 E AndroidRuntime at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2210)
01-22 15:25:50.227 19984 19984 E AndroidRuntime at android.os.Handler.dispatchMessage(Handler.java:106)
01-22 15:25:50.227 19984 19984 E AndroidRuntime at android.os.Looper.loopOnce(Looper.java:201)
01-22 15:25:50.227 19984 19984 E AndroidRuntime at android.os.Looper.loop(Looper.java:288)
01-22 15:25:50.227 19984 19984 E AndroidRuntime at android.app.ActivityThread.main(ActivityThread.java:7835)
01-22 15:25:50.227 19984 19984 E AndroidRuntime at java.lang.reflect.Method.invoke(Native Method)
01-22 15:25:50.227 19984 19984 E AndroidRuntime at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:550)
01-22 15:25:50.227 19984 19984 E AndroidRuntime at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
01-22 15:25:50.227 19984 19984 E AndroidRuntime Caused by: java.lang.ClassNotFoundException: androidx.lifecycle.LifecycleEventObserver
01-22 15:25:50.227 19984 19984 E AndroidRuntime … 17 more

layout