# Setup the Android Build Environment

## Doing a local build of the Glean SDK:

This document describes how to make local builds of the Android bindings in this repository. Most consumers of these bindings do not need to follow this process, but will instead use pre-built bindings.

Typically, this process only needs to be run once, although periodically you may need to repeat some steps (e.g., Rust updates should be done periodically).

### Setting up Android dependencies

#### With Android Studio

The easiest way to install all the dependencies (and automatically handle updates), is by using Android Studio. Once this is installed, start Android Studio and open the Glean project. If Android Studio asks you to upgrade the version of Gradle, decline.

The following dependencies can be installed in Android Studio through Tools > SDK Manager > SDK Tools:

• Android SDK Tools (may already be selected)
• NDK r21
• CMake
• LLDB

You should be set to build Glean from within Android Studio now.

#### Manually

Set JAVA_HOME to be the location of Android Studio's JDK which can be found in Android Studio's "Project Structure" menu (you may need to escape spaces in the path).

Note down the location of your SDK. If installed through Android Studio you will find the Android SDK Location in Tools > SDK Manager.

Set the ANDROID_HOME environment variable to that path. Alternatively add the following line to the local.properties file in the root of the Glean checkout (create the file if it does not exist):

sdk.dir=/path/to/sdk


For the Android NDK: