I got this working in Android Studio Giraffe | 2022.3.1 Patch 2 with the following (I'm a total newb to Android dev and Gradle so this is probably not the correct way to do this)
The code for the project build.gradle.kts :
val lifecycle_version by rootProject.extra { "2.5.1" }
The two code snippets below from the code lab give me errors as others have mentioned:
and
dependencies { implementation "androidx.lifecycle:lifecycle-viewmodel-compose:$lifecycle_version" }
I got this working in Android Studio Giraffe | 2022.3.1 Patch 2 with the following (I'm a total newb to Android dev and Gradle so this is probably not the correct way to do this)
The code for the project build.gradle.kts :
val lifecycle_version by rootProject.extra { "2.5.1" }
and the code for the app build.gradle.kts :
implementation("androidx.lifecycle:lifecycle-viewmodel-compose:${rootProject.extra.get("lifecycle_version")}")