In which task and step of the codelab can this issue be found?7. Add a top bar
Describe the problem
Compile error on CenterAlignedTopAppBar.
Error: "This material API is experimental and is likely to change or to be removed in the future."
Steps to reproduce?
Compile the example after placing the CenteralignedTopAppBar in the code.
see Error: "This material API is experimental and is likely to change or to be removed in the future."
VersionsAndroid Studio version:
Android Studio Iguana | 2023.2.1 Patch 1
Build #AI-232.10300.40.2321.11567975, built on March 13, 2024
Runtime version: 21+9-b75.2 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Windows 11.0
GC: G1 Young Generation, G1 Concurrent GC, G1 Old Generation
Memory: 4096M
Cores: 16
Registry:
ide.experimental.ui=true
Additional informationInclude screenshots if they would be useful in clarifying the problem.
Solution to the problem is to add @OptIn(ExperimentalMaterial3Api::class) to the WoofTopAppBar function.
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun WoofTopAppBar(modifier: Modifier = Modifier) {
CenterAlignedTopAppBar(
title = {
Row {
Image(
Would be helpful if the Codelab guided students to this solution instead of them having to spend a fair bit of time figuring out what to do. OR the CodeLab should be updated to use non-experimental features to avoid potential compiler errors.
URL of codelab Material Theming with Jetpack Compose
In which task and step of the codelab can this issue be found? 7. Add a top bar
Describe the problem Compile error on CenterAlignedTopAppBar. Error: "This material API is experimental and is likely to change or to be removed in the future."
Steps to reproduce?
Versions Android Studio version: Android Studio Iguana | 2023.2.1 Patch 1 Build #AI-232.10300.40.2321.11567975, built on March 13, 2024 Runtime version: 21+9-b75.2 amd64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. Windows 11.0 GC: G1 Young Generation, G1 Concurrent GC, G1 Old Generation Memory: 4096M Cores: 16 Registry: ide.experimental.ui=true
Non-Bundled Plugins: com.shuzijun.markdown-editor (2.0.5) com.villains.intelij.plugin.trashpandatheme (2.0.8) Docker (232.10300.41)
API version of the emulator: 34
Additional information Include screenshots if they would be useful in clarifying the problem. Solution to the problem is to add
@OptIn(ExperimentalMaterial3Api::class)
to theWoofTopAppBar
function.Would be helpful if the Codelab guided students to this solution instead of them having to spend a fair bit of time figuring out what to do. OR the CodeLab should be updated to use non-experimental features to avoid potential compiler errors.