問題紀錄
E FATAL EXCEPTION: main
Process: com.example.practiceviewstocompose, PID: 18798
java.lang.IllegalArgumentException: Navigation action/destination com.example.practiceviewstocompose:id/action_blankFragment_to_blankFragment2 cannot be found from the current destination Destination(com.example.practiceviewstocompose:id/blankFragment2) label=fragment_blank2 class=com.example.practiceviewstocompose.BlankFragment2
at androidx.navigation.NavController.navigate(NavController.kt:1687)
at androidx.navigation.NavController.navigate(NavController.kt:1605)
at androidx.navigation.NavController.navigate(NavController.kt:1587)
at androidx.navigation.NavController.navigate(NavController.kt:1570)
at com.example.practiceviewstocompose.BlankFragment.onViewCreated$lambda$0(BlankFragment.kt:41)
at com.example.practiceviewstocompose.BlankFragment.$r8$lambda$R3xHVaNYnxP688MWIWdKh9WO3GE(Unknown Source:0)
at com.example.practiceviewstocompose.BlankFragment$$ExternalSyntheticLambda0.onClick(Unknown Source:2)
at android.view.View.performClick(View.java:7658)
at com.google.android.material.button.MaterialButton.performClick(MaterialButton.java:1213)
at android.view.View.performClickInternal(View.java:7635)
at android.view.View.-$$Nest$mperformClickInternal(Unknown Source:0)
at android.view.View$PerformClick.run(View.java:30167)
at android.os.Handler.handleCallback(Handler.java:958)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:205)
at android.os.Looper.loop(Looper.java:294)
at android.app.ActivityThread.main(ActivityThread.java:8194)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)
原因
很可能是因為我在 onClick 內放了2次(相同目的地的)導航
解決方式
去除一個導航語句
0 comments:
張貼留言