2

I copied project from GitHub and I want to modify it. But I can't add LazyHorizontalGrid so I guess I need to update Jetpack Compose version or Gradle right? What is proper way of doing that because if I do it with Project Structure as IDE suggest app crashes and I can't even build project. I googled error and then next one and then next one and so on. But I think that it shouldn't be so hard to just update project.

Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841

1 Answers1

0

LazyHorizontalGrid was added with 1.2.0 of the Compose Foundation dependency.
To update just change your build.gradle files.

In the root build.gradle file:

buildscript {
    ext {
        compose_version = '1.2.1'
    }
    //..
    dependencies {
       //...
       classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10"

   }
}

In your app/build.gradle:

android {
    compileSdk 33
    //...
    composeOptions {
        kotlinCompilerExtensionVersion 1.3.1
        
    }
}

dependencies {
    implementation "androidx.compose.foundation:foundation:$compose_version"
    //...all the other compose dependencies
}

Check also the compatibility map for Compose Compiler Version/Kotlin Version.

Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841