DEV Community

Kenji Wada
Kenji Wada

Posted on

Installing Android Jetpack Compose (September 2020 ver)

Android Jetpack Compose is still under development and there is no stable version. Installation method also differs by version.

The official documentation doesn't seem to keep up with it, and the Japanese introduction document uses 0.1.0-dev13 in the description. The English introduction document uses 1.0.0-alpha01 in the description.

I was unable to install Jetpack Compose because of build errors in every deployment document I read.

The way described in Compose's version information is the only way I could install it without any build errors.

I found "Compose | Android Developers" helpful. I added the following in the build.gradle file, which enabled me to install Android Jetpack Compose.

android {
    buildFeatures {
        compose true
    }

    composeOptions {
        kotlinCompilerVersion "1.4.0"
        kotlinCompilerExtensionVersion "1.0.0-alpha02"
    }
}

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

Now that we're finally at the starting point, I'd like to experiment with implementing the UI using Jetpack Compose.

Note

The original article is "Android Jetpack Composeをインストールする (2020年9月版)". I use machine translation.

Discussion (0)