Why Android Studio shows setupWithNavController not exists?









up vote
2
down vote

favorite












NavigationUI.setupWithNavController(bottomNavigationView, navController)



When I run the app, the code is fine, but why it keeps showing compile error like this ?



The bottom navigation I use is in com.google.android.material:material, and the bottom navigation in the param is android.support.design.widget.BottomNavigationView. I know they are the same thing, but why it complains ?



enter image description here










share|improve this question

















  • 2




    Just restart Android Studio. The lint gets confused sometimes.
    – TheWanderer
    Oct 11 at 20:27










  • restart works for me. @TheWanderer can you put this as an answer ? I will accept this.
    – JIE WANG
    Nov 10 at 16:44















up vote
2
down vote

favorite












NavigationUI.setupWithNavController(bottomNavigationView, navController)



When I run the app, the code is fine, but why it keeps showing compile error like this ?



The bottom navigation I use is in com.google.android.material:material, and the bottom navigation in the param is android.support.design.widget.BottomNavigationView. I know they are the same thing, but why it complains ?



enter image description here










share|improve this question

















  • 2




    Just restart Android Studio. The lint gets confused sometimes.
    – TheWanderer
    Oct 11 at 20:27










  • restart works for me. @TheWanderer can you put this as an answer ? I will accept this.
    – JIE WANG
    Nov 10 at 16:44













up vote
2
down vote

favorite









up vote
2
down vote

favorite











NavigationUI.setupWithNavController(bottomNavigationView, navController)



When I run the app, the code is fine, but why it keeps showing compile error like this ?



The bottom navigation I use is in com.google.android.material:material, and the bottom navigation in the param is android.support.design.widget.BottomNavigationView. I know they are the same thing, but why it complains ?



enter image description here










share|improve this question













NavigationUI.setupWithNavController(bottomNavigationView, navController)



When I run the app, the code is fine, but why it keeps showing compile error like this ?



The bottom navigation I use is in com.google.android.material:material, and the bottom navigation in the param is android.support.design.widget.BottomNavigationView. I know they are the same thing, but why it complains ?



enter image description here







android androidx






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Oct 11 at 20:21









JIE WANG

474610




474610







  • 2




    Just restart Android Studio. The lint gets confused sometimes.
    – TheWanderer
    Oct 11 at 20:27










  • restart works for me. @TheWanderer can you put this as an answer ? I will accept this.
    – JIE WANG
    Nov 10 at 16:44













  • 2




    Just restart Android Studio. The lint gets confused sometimes.
    – TheWanderer
    Oct 11 at 20:27










  • restart works for me. @TheWanderer can you put this as an answer ? I will accept this.
    – JIE WANG
    Nov 10 at 16:44








2




2




Just restart Android Studio. The lint gets confused sometimes.
– TheWanderer
Oct 11 at 20:27




Just restart Android Studio. The lint gets confused sometimes.
– TheWanderer
Oct 11 at 20:27












restart works for me. @TheWanderer can you put this as an answer ? I will accept this.
– JIE WANG
Nov 10 at 16:44





restart works for me. @TheWanderer can you put this as an answer ? I will accept this.
– JIE WANG
Nov 10 at 16:44













2 Answers
2






active

oldest

votes

















up vote
1
down vote



accepted










Just restart Android Studio. The lint gets confused sometimes.






share|improve this answer



























    up vote
    0
    down vote













    Had the same issue. It's super confusing with all the different android packages now. androidx, android-arch, android-support. All of them in some weird version state with -rcX, alpha-X or beta-X...
    Using the following code I got the same error. But after telling AndroidStudio to File -> Invalidate Caches and Restart, it suddenly worked.



    Also I can highly recommend this tutorial: https://proandroiddev.com/android-jetpack-navigationui-a7c9f17c510e



    imports:




    implementation "android.arch.navigation:navigation-fragment-ktx:1.0.0-alpha07"
    implementation "android.arch.navigation:navigation-ui-ktx:1.0.0-alpha07"


    MainActivity




    import android.os.Bundle
    import androidx.appcompat.app.AppCompatActivity
    import androidx.navigation.findNavController
    import androidx.navigation.ui.NavigationUI
    import com.google.android.material.bottomnavigation.BottomNavigationView
    import net.onefivefour.android.ebtimetracker.R

    class MainActivity : AppCompatActivity()

    override fun onCreate(savedInstanceState: Bundle?)
    super.onCreate(savedInstanceState)
    setContentView(R.layout.activity_main)
    NavigationUI.setupWithNavController(findViewById(R.id.navigation), findNavController(R.id.navHostFragment))


    override fun onSupportNavigateUp() = findNavController(R.id.navHostFragment).navigateUp()



    Activity Layout



    <fragment
    android:id="@+id/navHostFragment"
    android:name="androidx.navigation.fragment.NavHostFragment"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    app:defaultNavHost="true"
    app:layout_constraintBottom_toTopOf="@+id/navigation"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent"
    app:navGraph="@navigation/nav_graph" />

    <com.google.android.material.bottomnavigation.BottomNavigationView
    android:id="@+id/navigation"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:background="?android:attr/windowBackground"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent"
    app:menu="@menu/navigation" />

    </androidx.constraintlayout.widget.ConstraintLayout>


    navigation.xml



    <activity
    android:id="@+id/mainActivity"
    android:name="net.onefivefour.android.ebtimetracker.ui.MainActivity"
    android:label="MainActivity"
    tools:layout="@layout/activity_main" />

    <fragment
    android:id="@+id/quickEntryFragment"
    android:name="net.onefivefour.android.ebtimetracker.ui.quickentry.QuickEntryFragment"
    android:label="QuickEntryFragment"
    tools:layout="@layout/fragment_quick_entry" />
    <fragment
    android:id="@+id/templatesFragment"
    android:name="net.onefivefour.android.ebtimetracker.ui.templates.TemplatesFragment"
    android:label="TemplatesFragment"
    tools:layout="@layout/fragment_templates" />
    <fragment
    android:id="@+id/entriesFragment"
    android:name="net.onefivefour.android.ebtimetracker.ui.entries.EntriesFragment"
    android:label="EntriesFragment"
    tools:layout="@layout/fragment_entries" />




    nav_graph.xml



    <activity
    android:id="@+id/mainActivity"
    android:name="net.onefivefour.android.ebtimetracker.ui.MainActivity"
    android:label="MainActivity"
    tools:layout="@layout/activity_main" />

    <fragment
    android:id="@+id/quickEntryFragment"
    android:name="net.onefivefour.android.ebtimetracker.ui.quickentry.QuickEntryFragment"
    android:label="QuickEntryFragment"
    tools:layout="@layout/fragment_quick_entry" />
    <fragment
    android:id="@+id/templatesFragment"
    android:name="net.onefivefour.android.ebtimetracker.ui.templates.TemplatesFragment"
    android:label="TemplatesFragment"
    tools:layout="@layout/fragment_templates" />
    <fragment
    android:id="@+id/entriesFragment"
    android:name="net.onefivefour.android.ebtimetracker.ui.entries.EntriesFragment"
    android:label="EntriesFragment"
    tools:layout="@layout/fragment_entries" />

    </navigation>





    share|improve this answer




















      Your Answer






      StackExchange.ifUsing("editor", function ()
      StackExchange.using("externalEditor", function ()
      StackExchange.using("snippets", function ()
      StackExchange.snippets.init();
      );
      );
      , "code-snippets");

      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "1"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader:
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      ,
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );













       

      draft saved


      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f52768334%2fwhy-android-studio-shows-setupwithnavcontroller-not-exists%23new-answer', 'question_page');

      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      1
      down vote



      accepted










      Just restart Android Studio. The lint gets confused sometimes.






      share|improve this answer
























        up vote
        1
        down vote



        accepted










        Just restart Android Studio. The lint gets confused sometimes.






        share|improve this answer






















          up vote
          1
          down vote



          accepted







          up vote
          1
          down vote



          accepted






          Just restart Android Studio. The lint gets confused sometimes.






          share|improve this answer












          Just restart Android Studio. The lint gets confused sometimes.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 10 at 16:49









          TheWanderer

          5,62611025




          5,62611025






















              up vote
              0
              down vote













              Had the same issue. It's super confusing with all the different android packages now. androidx, android-arch, android-support. All of them in some weird version state with -rcX, alpha-X or beta-X...
              Using the following code I got the same error. But after telling AndroidStudio to File -> Invalidate Caches and Restart, it suddenly worked.



              Also I can highly recommend this tutorial: https://proandroiddev.com/android-jetpack-navigationui-a7c9f17c510e



              imports:




              implementation "android.arch.navigation:navigation-fragment-ktx:1.0.0-alpha07"
              implementation "android.arch.navigation:navigation-ui-ktx:1.0.0-alpha07"


              MainActivity




              import android.os.Bundle
              import androidx.appcompat.app.AppCompatActivity
              import androidx.navigation.findNavController
              import androidx.navigation.ui.NavigationUI
              import com.google.android.material.bottomnavigation.BottomNavigationView
              import net.onefivefour.android.ebtimetracker.R

              class MainActivity : AppCompatActivity()

              override fun onCreate(savedInstanceState: Bundle?)
              super.onCreate(savedInstanceState)
              setContentView(R.layout.activity_main)
              NavigationUI.setupWithNavController(findViewById(R.id.navigation), findNavController(R.id.navHostFragment))


              override fun onSupportNavigateUp() = findNavController(R.id.navHostFragment).navigateUp()



              Activity Layout



              <fragment
              android:id="@+id/navHostFragment"
              android:name="androidx.navigation.fragment.NavHostFragment"
              android:layout_width="match_parent"
              android:layout_height="0dp"
              app:defaultNavHost="true"
              app:layout_constraintBottom_toTopOf="@+id/navigation"
              app:layout_constraintEnd_toEndOf="parent"
              app:layout_constraintStart_toStartOf="parent"
              app:layout_constraintTop_toTopOf="parent"
              app:navGraph="@navigation/nav_graph" />

              <com.google.android.material.bottomnavigation.BottomNavigationView
              android:id="@+id/navigation"
              android:layout_width="0dp"
              android:layout_height="wrap_content"
              android:background="?android:attr/windowBackground"
              app:layout_constraintBottom_toBottomOf="parent"
              app:layout_constraintLeft_toLeftOf="parent"
              app:layout_constraintRight_toRightOf="parent"
              app:menu="@menu/navigation" />

              </androidx.constraintlayout.widget.ConstraintLayout>


              navigation.xml



              <activity
              android:id="@+id/mainActivity"
              android:name="net.onefivefour.android.ebtimetracker.ui.MainActivity"
              android:label="MainActivity"
              tools:layout="@layout/activity_main" />

              <fragment
              android:id="@+id/quickEntryFragment"
              android:name="net.onefivefour.android.ebtimetracker.ui.quickentry.QuickEntryFragment"
              android:label="QuickEntryFragment"
              tools:layout="@layout/fragment_quick_entry" />
              <fragment
              android:id="@+id/templatesFragment"
              android:name="net.onefivefour.android.ebtimetracker.ui.templates.TemplatesFragment"
              android:label="TemplatesFragment"
              tools:layout="@layout/fragment_templates" />
              <fragment
              android:id="@+id/entriesFragment"
              android:name="net.onefivefour.android.ebtimetracker.ui.entries.EntriesFragment"
              android:label="EntriesFragment"
              tools:layout="@layout/fragment_entries" />




              nav_graph.xml



              <activity
              android:id="@+id/mainActivity"
              android:name="net.onefivefour.android.ebtimetracker.ui.MainActivity"
              android:label="MainActivity"
              tools:layout="@layout/activity_main" />

              <fragment
              android:id="@+id/quickEntryFragment"
              android:name="net.onefivefour.android.ebtimetracker.ui.quickentry.QuickEntryFragment"
              android:label="QuickEntryFragment"
              tools:layout="@layout/fragment_quick_entry" />
              <fragment
              android:id="@+id/templatesFragment"
              android:name="net.onefivefour.android.ebtimetracker.ui.templates.TemplatesFragment"
              android:label="TemplatesFragment"
              tools:layout="@layout/fragment_templates" />
              <fragment
              android:id="@+id/entriesFragment"
              android:name="net.onefivefour.android.ebtimetracker.ui.entries.EntriesFragment"
              android:label="EntriesFragment"
              tools:layout="@layout/fragment_entries" />

              </navigation>





              share|improve this answer
























                up vote
                0
                down vote













                Had the same issue. It's super confusing with all the different android packages now. androidx, android-arch, android-support. All of them in some weird version state with -rcX, alpha-X or beta-X...
                Using the following code I got the same error. But after telling AndroidStudio to File -> Invalidate Caches and Restart, it suddenly worked.



                Also I can highly recommend this tutorial: https://proandroiddev.com/android-jetpack-navigationui-a7c9f17c510e



                imports:




                implementation "android.arch.navigation:navigation-fragment-ktx:1.0.0-alpha07"
                implementation "android.arch.navigation:navigation-ui-ktx:1.0.0-alpha07"


                MainActivity




                import android.os.Bundle
                import androidx.appcompat.app.AppCompatActivity
                import androidx.navigation.findNavController
                import androidx.navigation.ui.NavigationUI
                import com.google.android.material.bottomnavigation.BottomNavigationView
                import net.onefivefour.android.ebtimetracker.R

                class MainActivity : AppCompatActivity()

                override fun onCreate(savedInstanceState: Bundle?)
                super.onCreate(savedInstanceState)
                setContentView(R.layout.activity_main)
                NavigationUI.setupWithNavController(findViewById(R.id.navigation), findNavController(R.id.navHostFragment))


                override fun onSupportNavigateUp() = findNavController(R.id.navHostFragment).navigateUp()



                Activity Layout



                <fragment
                android:id="@+id/navHostFragment"
                android:name="androidx.navigation.fragment.NavHostFragment"
                android:layout_width="match_parent"
                android:layout_height="0dp"
                app:defaultNavHost="true"
                app:layout_constraintBottom_toTopOf="@+id/navigation"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toTopOf="parent"
                app:navGraph="@navigation/nav_graph" />

                <com.google.android.material.bottomnavigation.BottomNavigationView
                android:id="@+id/navigation"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:background="?android:attr/windowBackground"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintLeft_toLeftOf="parent"
                app:layout_constraintRight_toRightOf="parent"
                app:menu="@menu/navigation" />

                </androidx.constraintlayout.widget.ConstraintLayout>


                navigation.xml



                <activity
                android:id="@+id/mainActivity"
                android:name="net.onefivefour.android.ebtimetracker.ui.MainActivity"
                android:label="MainActivity"
                tools:layout="@layout/activity_main" />

                <fragment
                android:id="@+id/quickEntryFragment"
                android:name="net.onefivefour.android.ebtimetracker.ui.quickentry.QuickEntryFragment"
                android:label="QuickEntryFragment"
                tools:layout="@layout/fragment_quick_entry" />
                <fragment
                android:id="@+id/templatesFragment"
                android:name="net.onefivefour.android.ebtimetracker.ui.templates.TemplatesFragment"
                android:label="TemplatesFragment"
                tools:layout="@layout/fragment_templates" />
                <fragment
                android:id="@+id/entriesFragment"
                android:name="net.onefivefour.android.ebtimetracker.ui.entries.EntriesFragment"
                android:label="EntriesFragment"
                tools:layout="@layout/fragment_entries" />




                nav_graph.xml



                <activity
                android:id="@+id/mainActivity"
                android:name="net.onefivefour.android.ebtimetracker.ui.MainActivity"
                android:label="MainActivity"
                tools:layout="@layout/activity_main" />

                <fragment
                android:id="@+id/quickEntryFragment"
                android:name="net.onefivefour.android.ebtimetracker.ui.quickentry.QuickEntryFragment"
                android:label="QuickEntryFragment"
                tools:layout="@layout/fragment_quick_entry" />
                <fragment
                android:id="@+id/templatesFragment"
                android:name="net.onefivefour.android.ebtimetracker.ui.templates.TemplatesFragment"
                android:label="TemplatesFragment"
                tools:layout="@layout/fragment_templates" />
                <fragment
                android:id="@+id/entriesFragment"
                android:name="net.onefivefour.android.ebtimetracker.ui.entries.EntriesFragment"
                android:label="EntriesFragment"
                tools:layout="@layout/fragment_entries" />

                </navigation>





                share|improve this answer






















                  up vote
                  0
                  down vote










                  up vote
                  0
                  down vote









                  Had the same issue. It's super confusing with all the different android packages now. androidx, android-arch, android-support. All of them in some weird version state with -rcX, alpha-X or beta-X...
                  Using the following code I got the same error. But after telling AndroidStudio to File -> Invalidate Caches and Restart, it suddenly worked.



                  Also I can highly recommend this tutorial: https://proandroiddev.com/android-jetpack-navigationui-a7c9f17c510e



                  imports:




                  implementation "android.arch.navigation:navigation-fragment-ktx:1.0.0-alpha07"
                  implementation "android.arch.navigation:navigation-ui-ktx:1.0.0-alpha07"


                  MainActivity




                  import android.os.Bundle
                  import androidx.appcompat.app.AppCompatActivity
                  import androidx.navigation.findNavController
                  import androidx.navigation.ui.NavigationUI
                  import com.google.android.material.bottomnavigation.BottomNavigationView
                  import net.onefivefour.android.ebtimetracker.R

                  class MainActivity : AppCompatActivity()

                  override fun onCreate(savedInstanceState: Bundle?)
                  super.onCreate(savedInstanceState)
                  setContentView(R.layout.activity_main)
                  NavigationUI.setupWithNavController(findViewById(R.id.navigation), findNavController(R.id.navHostFragment))


                  override fun onSupportNavigateUp() = findNavController(R.id.navHostFragment).navigateUp()



                  Activity Layout



                  <fragment
                  android:id="@+id/navHostFragment"
                  android:name="androidx.navigation.fragment.NavHostFragment"
                  android:layout_width="match_parent"
                  android:layout_height="0dp"
                  app:defaultNavHost="true"
                  app:layout_constraintBottom_toTopOf="@+id/navigation"
                  app:layout_constraintEnd_toEndOf="parent"
                  app:layout_constraintStart_toStartOf="parent"
                  app:layout_constraintTop_toTopOf="parent"
                  app:navGraph="@navigation/nav_graph" />

                  <com.google.android.material.bottomnavigation.BottomNavigationView
                  android:id="@+id/navigation"
                  android:layout_width="0dp"
                  android:layout_height="wrap_content"
                  android:background="?android:attr/windowBackground"
                  app:layout_constraintBottom_toBottomOf="parent"
                  app:layout_constraintLeft_toLeftOf="parent"
                  app:layout_constraintRight_toRightOf="parent"
                  app:menu="@menu/navigation" />

                  </androidx.constraintlayout.widget.ConstraintLayout>


                  navigation.xml



                  <activity
                  android:id="@+id/mainActivity"
                  android:name="net.onefivefour.android.ebtimetracker.ui.MainActivity"
                  android:label="MainActivity"
                  tools:layout="@layout/activity_main" />

                  <fragment
                  android:id="@+id/quickEntryFragment"
                  android:name="net.onefivefour.android.ebtimetracker.ui.quickentry.QuickEntryFragment"
                  android:label="QuickEntryFragment"
                  tools:layout="@layout/fragment_quick_entry" />
                  <fragment
                  android:id="@+id/templatesFragment"
                  android:name="net.onefivefour.android.ebtimetracker.ui.templates.TemplatesFragment"
                  android:label="TemplatesFragment"
                  tools:layout="@layout/fragment_templates" />
                  <fragment
                  android:id="@+id/entriesFragment"
                  android:name="net.onefivefour.android.ebtimetracker.ui.entries.EntriesFragment"
                  android:label="EntriesFragment"
                  tools:layout="@layout/fragment_entries" />




                  nav_graph.xml



                  <activity
                  android:id="@+id/mainActivity"
                  android:name="net.onefivefour.android.ebtimetracker.ui.MainActivity"
                  android:label="MainActivity"
                  tools:layout="@layout/activity_main" />

                  <fragment
                  android:id="@+id/quickEntryFragment"
                  android:name="net.onefivefour.android.ebtimetracker.ui.quickentry.QuickEntryFragment"
                  android:label="QuickEntryFragment"
                  tools:layout="@layout/fragment_quick_entry" />
                  <fragment
                  android:id="@+id/templatesFragment"
                  android:name="net.onefivefour.android.ebtimetracker.ui.templates.TemplatesFragment"
                  android:label="TemplatesFragment"
                  tools:layout="@layout/fragment_templates" />
                  <fragment
                  android:id="@+id/entriesFragment"
                  android:name="net.onefivefour.android.ebtimetracker.ui.entries.EntriesFragment"
                  android:label="EntriesFragment"
                  tools:layout="@layout/fragment_entries" />

                  </navigation>





                  share|improve this answer












                  Had the same issue. It's super confusing with all the different android packages now. androidx, android-arch, android-support. All of them in some weird version state with -rcX, alpha-X or beta-X...
                  Using the following code I got the same error. But after telling AndroidStudio to File -> Invalidate Caches and Restart, it suddenly worked.



                  Also I can highly recommend this tutorial: https://proandroiddev.com/android-jetpack-navigationui-a7c9f17c510e



                  imports:




                  implementation "android.arch.navigation:navigation-fragment-ktx:1.0.0-alpha07"
                  implementation "android.arch.navigation:navigation-ui-ktx:1.0.0-alpha07"


                  MainActivity




                  import android.os.Bundle
                  import androidx.appcompat.app.AppCompatActivity
                  import androidx.navigation.findNavController
                  import androidx.navigation.ui.NavigationUI
                  import com.google.android.material.bottomnavigation.BottomNavigationView
                  import net.onefivefour.android.ebtimetracker.R

                  class MainActivity : AppCompatActivity()

                  override fun onCreate(savedInstanceState: Bundle?)
                  super.onCreate(savedInstanceState)
                  setContentView(R.layout.activity_main)
                  NavigationUI.setupWithNavController(findViewById(R.id.navigation), findNavController(R.id.navHostFragment))


                  override fun onSupportNavigateUp() = findNavController(R.id.navHostFragment).navigateUp()



                  Activity Layout



                  <fragment
                  android:id="@+id/navHostFragment"
                  android:name="androidx.navigation.fragment.NavHostFragment"
                  android:layout_width="match_parent"
                  android:layout_height="0dp"
                  app:defaultNavHost="true"
                  app:layout_constraintBottom_toTopOf="@+id/navigation"
                  app:layout_constraintEnd_toEndOf="parent"
                  app:layout_constraintStart_toStartOf="parent"
                  app:layout_constraintTop_toTopOf="parent"
                  app:navGraph="@navigation/nav_graph" />

                  <com.google.android.material.bottomnavigation.BottomNavigationView
                  android:id="@+id/navigation"
                  android:layout_width="0dp"
                  android:layout_height="wrap_content"
                  android:background="?android:attr/windowBackground"
                  app:layout_constraintBottom_toBottomOf="parent"
                  app:layout_constraintLeft_toLeftOf="parent"
                  app:layout_constraintRight_toRightOf="parent"
                  app:menu="@menu/navigation" />

                  </androidx.constraintlayout.widget.ConstraintLayout>


                  navigation.xml



                  <activity
                  android:id="@+id/mainActivity"
                  android:name="net.onefivefour.android.ebtimetracker.ui.MainActivity"
                  android:label="MainActivity"
                  tools:layout="@layout/activity_main" />

                  <fragment
                  android:id="@+id/quickEntryFragment"
                  android:name="net.onefivefour.android.ebtimetracker.ui.quickentry.QuickEntryFragment"
                  android:label="QuickEntryFragment"
                  tools:layout="@layout/fragment_quick_entry" />
                  <fragment
                  android:id="@+id/templatesFragment"
                  android:name="net.onefivefour.android.ebtimetracker.ui.templates.TemplatesFragment"
                  android:label="TemplatesFragment"
                  tools:layout="@layout/fragment_templates" />
                  <fragment
                  android:id="@+id/entriesFragment"
                  android:name="net.onefivefour.android.ebtimetracker.ui.entries.EntriesFragment"
                  android:label="EntriesFragment"
                  tools:layout="@layout/fragment_entries" />




                  nav_graph.xml



                  <activity
                  android:id="@+id/mainActivity"
                  android:name="net.onefivefour.android.ebtimetracker.ui.MainActivity"
                  android:label="MainActivity"
                  tools:layout="@layout/activity_main" />

                  <fragment
                  android:id="@+id/quickEntryFragment"
                  android:name="net.onefivefour.android.ebtimetracker.ui.quickentry.QuickEntryFragment"
                  android:label="QuickEntryFragment"
                  tools:layout="@layout/fragment_quick_entry" />
                  <fragment
                  android:id="@+id/templatesFragment"
                  android:name="net.onefivefour.android.ebtimetracker.ui.templates.TemplatesFragment"
                  android:label="TemplatesFragment"
                  tools:layout="@layout/fragment_templates" />
                  <fragment
                  android:id="@+id/entriesFragment"
                  android:name="net.onefivefour.android.ebtimetracker.ui.entries.EntriesFragment"
                  android:label="EntriesFragment"
                  tools:layout="@layout/fragment_entries" />

                  </navigation>






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 10 at 13:45









                  muetzenflo

                  1,51011642




                  1,51011642



























                       

                      draft saved


                      draft discarded















































                       


                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f52768334%2fwhy-android-studio-shows-setupwithnavcontroller-not-exists%23new-answer', 'question_page');

                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      這個網誌中的熱門文章

                      How to read a connectionString WITH PROVIDER in .NET Core?

                      In R, how to develop a multiplot heatmap.2 figure showing key labels successfully

                      Museum of Modern and Contemporary Art of Trento and Rovereto