Table of contents
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:
-
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.
-
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:
-
Set the Android SDK location in one of these two ways:
-
Create
local.properties
in the root of the repository and then set thesdk.dir property
it contains. Android Studio can do this automatically when opening a project. For example, usesdk.dir=$HOME/Android/Sdk
. -
Set the
ANDROID_SDK_ROOT
environment variable with the path to the Android SDK.
-
-
Open a command prompt or a shell window.
-
Go to the root of the DesignCompose repository.
-
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