NavHostFragment not accessible from XML

前端 未结 6 1765
天涯浪人
天涯浪人 2021-02-14 06:08

I wanted to try new Navigation library. After following this guideline I experienced error at runtime:

Caused by: android.view.InflateException: Binary XML file          


        
6条回答
  •  情书的邮戳
    2021-02-14 06:56

    I also just have this headache as I am following Android Kotlin Fundamental tutorial at https://codelabs.developers.google.com/codelabs/kotlin-android-training-add-navigation/index.html#3 Here is the code that works for me

    
    

    Apparently the tutorial has not been updated. Also in the dependency need to update the library ..

    ....    
    implementation "androidx.navigation:navigation-fragment:2.3.0"
    implementation "androidx.navigation:navigation-ui:2.3.0"
    

    I am using Android Studio 4.0.

提交回复
热议问题