Table of contents
  1. Build the SDK from source
    1. Install required dependencies
      1. Android Studio
      2. Android NDK
      3. Rust
      4. Rust toolchains
    2. Check out the code
    3. Build the code
      1. Android Studio
      2. Command line

Build the SDK from source

This page outlines how to download and build the Automotive Design for Compose source.

Install required dependencies

Additional dependencies are required to compile the SDK.

Android Studio

The source requires Android Studio Flamingo or later.

Android NDK

Version 27.0.12077973 is required. You can install the NDK with Android Studio’s SDK Manager or on the command line using the sdkmanager binary:

"${ANDROID_HOME}/cmdline-tools/latest/bin/sdkmanager" \
    --install "ndk;27.0.12077973"

Rust

Rust 1.63.0 is required to compile DesignCompose’s Live Update service. Installation instructions are on the Rust installer page.

To complete the Rust installation the Android Studio IDE must be aware of the new install. There are many ways to do this, but the simplest way to do this is to reboot your computer.

Rust toolchains

The DesignCompose library includes a Rust JNI library, which must be compiled for multiple system types. Install the toolchains that DesignCompose needs by running the following:

rustup target add \
    armv7-linux-androideabi \
    i686-linux-android \
    aarch64-linux-android \
    x86_64-linux-android

Check out the code

To check out the code, run the following:

git clone https://github.com/google/automotive-design-compose.git

Build the code

Instructions are provided for building DesignCompose and it’s reference apps using both Android Studio and the command line. The examples below describe how to build the Tutorial app.

Android Studio

To build the code in Android Studio:

  1. Open the root of the DesignCompose repository in Android Studio.

    Android Studio syncs with the code and populates the run configurations menu with entries for each of the included apps.

  2. Build the Tutorial app using either the basic or advanced instructions in Build and run your app The Tutorial app is listed in the run configurations menu as reference-apps:tutorial.

Command line

To build the code from the command line:

  1. Set the Android SDK location in one of these two ways:

    • Create local.properties in the root of the repository and then set the sdk.dir property it contains. Android Studio can do this automatically when opening a project. For example, use sdk.dir=$HOME/Android/Sdk.

    • Set the ANDROID_SDK_ROOT environment variable with the path to the Android SDK.

  2. Open a command prompt or a shell window.

  3. Go to the root of the DesignCompose repository.

  4. Run the following command:

    ./gradlew reference-apps:tutorial:assembleDebug
    

    The apps are built in the normal build output directories. For example, the Tutorial app’s debug variant are located in reference-apps/tutorial/build/outputs/apk/debug/tutorial-debug.apk