Create a new Compose project
Android Studio projects need configuration to work with Relay. To start, create a project that supports Jetpack Compose version 1.2 or newer.
- In Android Studio, create a new project (File > New > New Project…).
-
Select Empty Compose Activity and click Next.
-
Give your project a name. Accept all other defaults, including the language as Kotlin and the minimum SDK as API 21: Android 5.0 (Lollipop) and click Finish.
Edit module-level Gradle build file
Set up the module-level Gradle build file to use the Relay Gradle plugin.
Open
build.gradle
(Module:Hello_Figma.app
— This can vary based on the name you entered above). This is the module-level Gradle build file.Add the Relay plugin in the module's Gradle file as shown below, changing the version number as appropriate. Save the file.
Groovy
plugins { id 'com.android.application' id 'kotlin-android' id 'com.google.relay' version '0.3.12' }
Kotlin
plugins { id("com.android.application") id("kotlin-android") id("com.google.relay") version "0.3.12" }
Click Sync Now.
Recommended for you
- Note: link text is displayed when JavaScript is off
- Testing your Compose layout
- Where to hoist state
- Resources in Compose