androidkotlinandroid-jetpack-composebuild.gradle

How to resolve "Use a different version of dependency"?


Dependency 'androidx.activity:activity-compose:1.6.0-alpha01' requires libraries and applications that depend on it to compile against codename "Tiramisu" of the Android APIs.

  :app is currently compiled against android-34.

  Recommended action: Use a different version of dependency 'androidx.activity:activity-compose:1.6.0-alpha01',
  or set compileSdkPreview to "Tiramisu" in your build.gradle
  file if you intend to experiment with that preview SDK.

I tried to compile, but it's giving me the error above. How can I resolve this?


Solution

  • You seem to be using an outdated version of the androidx.activity:activity-compose library. You should be using version 1.9.0 right now, or the latest version according to the official release docs

    If you have a reason to keep using the older version (which I don't advise), you'll also have to downgrade your Android compileSdk version from 34 also.