Setting up the Android module
Since we tested part of the shared code in Chapter 5, Writing Shared Code, we have already done most of the setup. Let's go through what we need to set up before implementing the Android app.
Enabling Jetpack Compose
We'll be using Android's new UI Toolkit: Jetpack Compose. So, first, we'll need to enable it. You can find the official setup guide here: https://developer.android.com/jetpack/compose/setup#add-compose.
To enable Jetpack Compose, we'll need to add the following configurations to the build.gradle.kts
file of the androidApp
module, under the android{}
configuration block:
- Enable the
compose
build feature:buildFeatures { compose = true }
- Make sure both the Kotlin and Java compilers target Java 8:
compileOptions { sourceCompatibility = JavaVersion.VERSION_1_8 ...