kodecocodes / jet-materials

The projects and the materials that accompany the Jetpack Compose book
Other
167 stars 93 forks source link

useIR = true is required to build examples #18

Open colintheshots-meetup opened 3 years ago

colintheshots-meetup commented 3 years ago

All of the examples should have their build.gradle scripts updated to include android.kotlinOptions.useIR = true or to include the following block of alpha flags. Without these changes, the samples do not currently build in many Android Studio setups due to mixed Kotlin 1.4 and 1.3 compilers being used simultaneously.

This isn't supposed to be required because the documentation calls out that Jetpack Compose opts you in automatically, but it does not. https://kotlinlang.org/docs/whatsnew14.html#new-jvm-ir-backend

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
    kotlinOptions {
        jvmTarget = "1.8"
        freeCompilerArgs += ["-Xallow-jvm-ir-dependencies", "-Xskip-prerelease-check"]
    }
}
filbabic commented 3 years ago

Hey @colintheshots-meetup!

We're going through multiple edits of each chapter and project in our process and we had no issues with this. But we'll take a look, as we're currently updating the book to match one of the latest beta versions, to keep it ready for use.

Thanks!