Jetpack Compose is a new UI toolkit for Android, utilizing Kotlin and a declarative style to create UIs as functions rather than objects. It requires specific versions of Android Studio, the Android Gradle plugin, and Kotlin, along with certain dependencies to operate correctly. Resources and sample states for Jetpack Compose are available, indicating ongoing development and community interest.
How to useJetpack
Compose?
• https://adambennett.dev/2019/10/jetpack-compose-now-on-maven/
• Android Studio Version >= 3.5.1
// Use Jvm 1.8
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
// Kotlin Reflect
implementation “org.jetbrains.kotlin:kotlin-reflect"
// Compose
kapt "androidx.compose:compose-compiler:0.1.0-dev01"
implementation "androidx.compose:compose-runtime:0.1.0-dev02"
// Compose UI
implementation "androidx.ui:ui-core:0.1.0-dev02"
implementation "androidx.ui:ui-layout:0.1.0-dev02"
implementation "androidx.ui:ui-material:0.1.0-dev01"
11.
But…Something Broken?
• @Modelobserving失效了了!!!
Compose requires:
• An unreleased version of the Android Gradle Plugin
• An unreleased version of Android Studio
• An unreleased EAP version of Kotlin
• Build via AOSP
• https://engineering.q42.nl/try-jetpack-compose-today/