kodecocodes/jet-materials

useIR = true is required to build examples

Opened this issue · 1 comments

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"]
    }
}

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!