Cannot resolve symbol 'NavigationView'

Search for NavigationView in the Android Studio pallet, and click on the Download arrow next to it. It will add the following to your code:

import com.google.android.material.navigation.NavigationView;

It sounds like you do not have the library included as a Gradle dependency.

Add the following to your build.gradle:

dependencies {
    compile 'com.android.support:design:22.2.1'
}

The error message "Could not find com.android.support:design:22.2.1." means that you likely do not have the latest version of the Android Support Repository installed. Open up your SDK Manager and ensure that the "Android Support Library" and "Android Support Repository" items under "Extras" are up to date.


If you're using AndroidX, Use:

implementation 'com.google.android.material:material:1.0.0'

And in you're layout resource file:

<com.google.android.material.navigation.NavigationView
...
...
/>