Reputation: 367
So I'm working in Android Studio (2.3.1) and I created a Bottom Navigation Activity, but I keep getting an error saying that the BottomNavigationView does not exist or cannot be found.
Error:(5, 37) error: cannot find symbol class BottomNavigationView
Error:(14, 33) error: package BottomNavigationView does not exist
Error:(15, 39) error: package BottomNavigationView does not exist
Error:(41, 9) error: cannot find symbol class BottomNavigationView
Error:(41, 44) error: cannot find symbol class BottomNavigationView
Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
Upvotes: 1
Views: 10543
Reputation: 3063
UPDATE
You should migrate to androidx package:
com.google.android.material:material:1.0.0-rc01
You can find here the mappings between the old support package and the new android package: AndroidX Migration
Upvotes: 0
Reputation: 4234
Have you added the right dependency in the app level build.gradle?
compile 'com.android.support:design:25.0.0'
Look at this link for more informations.
Upvotes: 4
Reputation: 25260
I met a relay dumb situation that I had used the 25 level SDK but it still says that after a full sync and rebuilt. So I add this manual import to my Java file and the error was finally gone.
import android.support.design.widget.BottomNavigationView;
Upvotes: 1
Reputation: 2153
At your build.gradle (Module:app) add this line of code:
compile 'com.android.support:design:25.0.0'
Google added BottomNavigationView in version 25.0.0, so the required dependency is com.android.support:design:25.0.0
which you might be missing.
For more information visit Official Android BottomNavigationView page
Thanks!
Upvotes: 1