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

Apache License 2.0
98 stars 140 forks source link

Android Basics: Viewmodel and State in Compose #137

Closed JPM-Tech closed 1 year ago

JPM-Tech commented 1 year ago

In part 6 Architecting your Compose UI, in step 1 of Passing the Data, the tutorial suggests adding the following code block, however, when adding the import statement, Android Studio doesn't know what to do with "androidx.lifecycle.viewmodel.compose" and it suggests to re-name the word compose.

import androidx.lifecycle.viewmodel.compose.viewModel

@Composable
fun GameScreen(
   gameViewModel: GameViewModel = viewModel()
) {
   // ...
}

I'm not sure how to fix this error, but wanted to make sure it was reported

JPM-Tech commented 1 year ago

Looks like performing a sync in the file fixed it for me