当我尝试将导航图设置到我的应用程序时,我收到此错误:
日志猫:
2019-04-05 11:56:35.949 16357-16357/com.example.supplier E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.supplier, PID: 16357
java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/navigation/NavController$OnNavigatedListener;
at androidx.navigation.ui.NavigationUI.setupWithNavController(NavigationUI.java:326)
at androidx.navigation.ui.BottomNavigationViewKt.setupWithNavController(BottomNavigationView.kt:30)
at com.example.supplier.ui.home.HomeActivity.onCreate(HomeActivity.kt:44)
at android.app.Activity.performCreate(Activity.java:7650)
at android.app.Activity.performCreate(Activity.java:7639)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1295)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3077)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3237)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:81)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1929)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:209)
at android.app.ActivityThread.main(ActivityThread.java:7021)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:486)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:872)
Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.navigation.NavController$OnNavigatedListener" on path: DexPathList[[zip file "/data/app/com.example.supplier-W8Y7SkqHjjs074Vzzhu0rQ==/base.apk"],nativeLibraryDirectories=[/data/app/com.example.supplier-W8Y7SkqHjjs074Vzzhu0rQ==/lib/x86, /system/lib, /system/product/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:195)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at androidx.navigation.ui.NavigationUI.setupWithNavController(NavigationUI.java:326)
at androidx.navigation.ui.BottomNavigationViewKt.setupWithNavController(BottomNavigationView.kt:30)
at com.example.supplier.ui.home.HomeActivity.onCreate(HomeActivity.kt:44)
at android.app.Activity.performCreate(Activity.java:7650)
at android.app.Activity.performCreate(Activity.java:7639)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1295)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3077)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3237)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:81)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1929)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:209)
at android.app.ActivityThread.main(ActivityThread.java:7021)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:486)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:872)