My MainActivity looks this way:
class MainActivity : ComponentActivity() {
@SuppressLint("UnusedMaterial3ScaffoldPaddingParameter")
@OptIn(ExperimentalMaterial3Api::class)
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
BottomNavTheme {
Scaffold(bottomBar = {
BottomNavigation(
backgroundColor = colorResource(id = R.color.teal_200),
contentColor = Color.Black
) {
}
}) {
}
}
}
}
}
The code should be alright, I guess. But it results in an "Unresolved reference:"-error

I have implemented that functionality in the past already. It wasn't that hard to do.
What goes wrong here? How can the issue become fixed?
Have there been changes? I'm using the very new Android Studio Flamingo.
Renamed to NavigationBar in m3.
For more information about the changes in the new version of the material, refer to the following link:
Migrate from Material 2 to Material 3 in Compose
Make sure that:
You added this dependency in your app module's build.gradle file:
implementation "androidx.compose.material:material:1.4.2"
You imported androidx.compose.material.BottomNavigation in your MainActivity.kt file.
If you did all these steps below, the error has to be disappeared. If it is not, try to invalidate caches and restart Android Studio:
File -> Invalidate caches -> [Mark all options such as clear file system cache etc.] -> Invalidate & Restart
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With