google-developer-training / basic-android-kotlin-compose-training-woof

Apache License 2.0
48 stars 70 forks source link

Material Theming: Android Basics with Compose: TopAppBar #52

Open DeocBrut opened 10 months ago

DeocBrut commented 10 months ago

URL of codelab https://developer.android.com/codelabs/basic-android-kotlin-compose-material-theming?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-compose-unit-3-pathway-3%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-compose-material-theming#6

In which task and step of the codelab can this issue be found? Adding the CenterAlignedTopAppBar

Describe the problem When I added the code for the top app bar, the code couldn't compile, because " This material API is experimental and is likely to change or to be removed in the future." I then added this line of code above the composable WoofTopAppBar and it compiled: @OptIn(ExperimentalMaterial3Api::class)

Steps to reproduce? I have no idea, because my code is exactly the same as the solution code. However the solution code compiled and mine didn't.

Versions Android Studio version: Android Studio Flamingo | 2022.2.1 Build #AI-222.4459.24.2221.9862592, built on March 31, 2023

API version of the emulator: Pixel_3a_API_33_x86_64

Additional information Screenshot attached Woof - TopAppBar is experimental API

Nicholas-Ustick commented 1 month ago

This is a duplicate of #37 which shows how the sample build parameters need to be updated to fix the issue w/o the need for the OptIn annotation.