Unresolved reference with Modifier methods in Jetpack compose

Solution 1:

Everything looks fine. Make sure you're using the newest version of Android Studio, gradle and compose versions.

  • Android Studio Arctic Fox | 2020.3.1 Canary 14
  • Compose Version 1.0.0-beta05
implementation "androidx.compose.ui:ui:$compose_version"
implementation "androidx.compose.ui:ui-tooling:$compose_version"
implementation "androidx.compose.material:material:$compose_version"
implementation "androidx.compose.material:material-ripple:$compose_version"
  • Plugins
classpath 'com.android.tools.build:gradle:7.0.0-alpha14'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.32"

And finally, check if you imported the correct Modifier class. You must use the one from androidx.compose.ui package.

Solution 2:

Updating your Compose and Kotlin plugin version in the project level gradle files would fix it. If that does not work then try syncing project with gradle files.