Jetpack Compose – Unresolved reference: observeAsState

observeAsState is part of the runtime-livedata library.

Add the dependency to your module’s build.gradle file. Replace $compose_version with the version of compose which you use, e.g. 1.0.0-beta01:

implementation "androidx.compose.runtime:runtime-livedata:$compose_version"

You can find the available versions here in Google’s Maven repository.

Leave a Comment