Use Android Studio with Jetpack Compose

Stay organized with collections Save and categorize content based on your preferences.

For the best experience developing with Jetpack Compose, download and install Android Studio. It includes many smart editor features, such as new project templates and the ability to immediately preview your Compose UI and animations.

Get Android Studio

After you've installed Android Studio, follow the instructions below to try a Jetpack Compose sample app, create a new Jetpack Compose app project, or add support for Jetpack Compose to an existing app project.

Try Jetpack Compose sample apps

After you’ve the latest version of Android Studio running, the fastest way to experiment with the capabilities of Jetpack Compose is by trying Jetpack Compose sample apps hosted on GitHub. To import a sample app project from Android Studio, proceed as follows:

  1. If you’re in the Welcome to Android Studio window, select Import an Android code sample. If you already have an Android Studio project open, select File > New > Import Sample from the menu bar.
  2. In the search bar near the top of the Browse Samples wizard, type "compose".
  3. Select one of the Jetpack Compose sample apps from the search results and click Next.
  4. Either change the Application name and Project location or keep the default values.
  5. Click Finish.

Android Studio downloads the sample app to the path you specified and opens the project. You can then inspect MainActivity.kt in each of the examples to see Jetpack Compose APIs such as crossfade animation, custom components, using typography, and displaying light and dark colors in the in-IDE preview.

Create a new app with support for Jetpack Compose

If you want to start a new project that includes support for Jetpack Compose by default, Android Studio includes new project templates to help you get started. To create a new project that includes Jetpack Compose, proceed as follows:

  1. If you’re in the Welcome to Android Studio window, click Start a new Android Studio project. If you already have an Android Studio project open, select File > New > New Project from the menu bar.
  2. In the Select a Project Template window, select Empty Compose Activity and click Next.
  3. In the Configure your project window, do the following:
    1. Set the Name, Package name, and Save location as you normally would.
    2. Note that, in the Language dropdown menu, Kotlin is the only available option because Jetpack Compose works only with classes written in Kotlin.
    3. In the Minimum API level dropdown menu, select API level 21 or higher.
  4. Click Finish.
  5. Verify that the project's build.gradle file is configured correctly, as described in Add Jetpack Compose toolkit dependencies.

Now you're ready to start developing an app using Jetpack Compose. To help you get started and learn about what you can do with the toolkit, try the Jetpack Compose tutorial.

To use Jetpack Compose for Wear OS, see Set up Jetpack Compose on Wear OS.

Add Jetpack Compose toolkit dependencies

Include Jetpack Compose toolkit dependencies in your app’s build.gradle file, as shown below:


dependencies {
    implementation 'androidx.compose.ui:ui:1.2.1'
    // Tooling support (Previews, etc.)
    implementation 'androidx.compose.ui:ui-tooling:1.2.1'
    // Foundation (Border, Background, Box, Image, Scroll, shapes, animations, etc.)
    implementation ''
    // Material Design
    implementation 'androidx.compose.material:material:1.2.1'
    // Material design icons
    implementation 'androidx.compose.material:material-icons-core:1.2.1'
    implementation 'androidx.compose.material:material-icons-extended:1.2.1'
    // Integration with activities
    implementation 'androidx.activity:activity-compose:1.5.1'
    // Integration with ViewModels
    implementation 'androidx.lifecycle:lifecycle-viewmodel-compose:2.5.1'
    // Integration with observables
    implementation 'androidx.compose.runtime:runtime-livedata:1.2.1'
    implementation 'androidx.compose.runtime:runtime-rxjava2:1.2.1'

    // UI Tests
    androidTestImplementation 'androidx.compose.ui:ui-test-junit4:1.2.1'


dependencies {
    // Tooling support (Previews, etc.)
    // Foundation (Border, Background, Box, Image, Scroll, shapes, animations, etc.)
    // Material Design
    // Material design icons
    // Integration with observables

    // UI Tests

Add Jetpack Compose to an existing project

If you want to use Jetpack Compose in an existing project, you’ll need to configure your project with required settings and dependencies. For more information, see Adding Jetpack Compose to your app.