For Developers‎ > ‎How-Tos‎ > ‎

Build Instructions (Android)


A Linux build machine capable of building Chrome for Linux. Other (Mac/Windows) platforms are not supported for Android.

Get the code

First, check out and install the depot_tools package.

Then, if you have no existing checkout, create your source directory and get the code:

$ mkdir ~/chromium && cd ~/chromium
~/chromium$ fetch --nohooks android   # This will take 30 minutes on a fast connection

If you have an existing Linux checkout, you can add Android support by appending 
target_os = ['android'] to your .gclient file (in the directory above src):

~/chromium/src$ cat ../.gclient
solutions = [
  ...existing stuff in here...

target_os = [ 'android' ]  # Add this to get Android stuff checked out.

Then run gclient sync to get the Android stuff checked out:

~/chromium/src$ gclient sync

(Optional) Check out LKGR

If you want a single build of Chromium in a known good state, sync to the LKGR ("last known good revision"). You can find it here, and the last 100 here. Run:

~/chromium$ gclient sync --nohooks -r <lkgr-sha1>

This is not needed for a typical developer workflow; only for one-time builds of Chromium.

Configure your build

Android builds can be run with GN or GYP, though GN incremental builds are the fastest option and GN will soon be the only supported option. They are both meta-build systems that generate ninja files for the Android build. Both builds are regularly tested on the build waterfall.

Configure GYP (deprecated -- use GN instead)

If you are using GYP, next to the .gclient file, create a a file called chromium.gyp_env with the following contents:

~/chromium$ echo "{ 'GYP_DEFINES': 'OS=android target_arch=arm', }" > chromium.gyp_env

Note that "arm" is the default architecture and can be omitted. If building for x86 or MIPS devices, change target_arch to "ia32" or "mipsel".

NOTE: If you are using the GYP_DEFINES environment variable, it will override any settings in this file. Either clear it or set it to the values above before running gclient runhooks.

See build/android/developer_recommended_flags.gypi for other recommended GYP settings.

Once chromium.gyp_env is ready, you need to run the following command to update projects from gyp files. You may need to run this again when you have added new files, updated gyp files, or sync'ed your repository.

~/chromium$ gclient runhooks

This will download more things and prompt you to accept Terms of Service for Android SDK packages.

Configure GN (recommended)

If you are using GN, create a build directory and set the build flags with:

~/chromium/src$ gn args out/Default

You can replace out/Default with another name you choose inside the out directory. Do not use GYP's out/Debug or out/Release directories, as they may conflict with GYP builds.

Also be aware that some scripts (e.g., require you to set CHROMIUM_OUTPUT_DIR=out/Default.

This command will bring up your editor with the GN build args. In this file add:

target_os = "android"
target_cpu = "arm"  # (default)
is_debug = true  # 

# Other args you may want to set:
is_component_build = true
is_clang = true
symbol_level = 1  # Faster build with fewer symbols. -g1 rather than -g2
enable_incremental_javac = true  # Much faster; experimental

You can also specify target_cpu values of "x86" and "mipsel". Re-run gn args on that directory to edit the flags in the future. See the GN build configuration page for other flags you may want to set.

Install build dependencies

Update the system packages required to build by running:

~/chromium$ src/build/

Make also sure that OpenJDK 1.7 is selected as default:

sudo update-alternatives --config javac
sudo update-alternatives --config java
sudo update-alternatives --config javaws
sudo update-alternatives --config javap
sudo update-alternatives --config jar
sudo update-alternatives --config jarsigner

Synchronize sub-directories.

~/chromium/src$ gclient sync

Build and install the APKs

If the script below fails, make sure aapt is in your PATH. If not, add aapt's path to your PATH environment variable (it should be /path/to/src/third_party/android_tools/sdk/build-tools/{latest_version}/)

Prepare the environment:

~/chromium/src$ . build/android/

Plug in your Android device

Make sure your Android device is plugged in via USB, and USB Debugging is enabled.

To enable USB Debugging:
  • Navigate to Settings > About Phone > Build number
  • Click 'Build number' 7 times
  • Now navigate back to Settings > Developer Options
  • Enable 'USB Debugging' and follow the prompts
You may also be prompted to allow access to your PC once your device is plugged in.

You can check if the device is connected by running:

third_party/android_tools/sdk/platform-tools/adb devices

which prints a list of connected devices. If not connected, try unplugging and reattaching your device.

Build the full browser

Note: When adding new resource files or java files in gyp builds, you need to run 'gclient runhooks' again to get them in the build.

~/chromium/src$ ninja -C out/Default chrome_public_apk

And deploy it to your Android device:

~/chromium/src$ build/android/ out/Release/apks/ChromePublic.apk                        # For gyp.
~/chromium/src$ CHROMIUM_OUTPUT_DIR=$gndir build/android/ $gndir/apks/ChromePublic.apk  # For gn.

The app will appear on the device as "Chromium".

Build Content shell

Wraps the content module (but not the /chrome embedder). See for details on the content module and content shell.

~/chromium/src$ ninja -C out/Default content_shell_apk
~/chromium/src$ build/android/ out/Release/apks/ContentShell.apk

this will build and install an Android apk under out/Release/apks/ContentShell.apk. For GYP, replace Release with Debug above if you want to generate a Debug app. If you are using GN, substitute the name you initially gave to your build directory.

If you use custom out dir instead of standard out/ dir, use CHROMIUM_OUT_DIR env.

> export CHROMIUM_OUT_DIR=out_android

Build WebView shell

Android WebView is a system framework component. Since Android KitKat, it is implemented using Chromium code (based off the content module). It is possible to test modifications to WebView using a simple test shell. The WebView shell is a view with a URL bar at the top (see code) and is independent of the WebView implementation in the Android system (the WebView shell is essentially a standalone unbundled app). As drawback, the shell runs in non-production rendering mode only.

~/chromium/src$ ninja -C out/Default android_webview_apk
~/chromium/src$ build/android/ out/Release/apks/AndroidWebView.apk

If, instead, you want to build the complete Android WebView framework component and test the effect of your chromium changes in other Android app using the WebView, you should follow the Android AOSP + chromium WebView instructions


Set command line flags if necessary.

For Content shell:

~/chromium/src$ build/android/adb_run_content_shell

For Chrome public:

~/chromium/src$ build/android/adb_run_chrome_public

For Android WebView shell:

~/chromium/src$ build/android/adb_run_android_webview_shell

Logging and debugging

Logging is often the easiest way to understand code flow. In C++ you can print log statements using the LOG macro or printf(). In Java, you can print log statements using android.util.Log:

Log.d("sometag", "Reticulating splines progress = " + progress);

You can see these log statements using adb logcat:

> adb logcat
01-14 11:08:53.373 22693 23070 D sometag: Reticulating splines progress = 0.99

You can debug Java or C++ code. To debug C++ code, use one of the following commands:

~/chromium/src$ build/android/adb_gdb_content_shell
~/chromium/src$ build/android/adb_gdb_chrome_public
~/chromium/src$ build/android/adb_gdb_android_webview_shell

See Debugging Chromium on Android for more on debugging, including how to debug Java code.


For information on running tests, see

Faster Edit/Deploy (GN only)

GN's "incremental install" uses reflection and side-loading to speed up the edit & deploy cycle (normally < 10 seconds).
  • Make sure to set is_component_build = true in your GN args
  • All apk targets have *_incremental targets defined (e.g. chrome_public_apk_incremental)
Here's an example:

ninja -C out/Default chrome_public_apk_incremental
out/Default/bin/install_chrome_public_apk_incremental -v

For gunit tests (note that run_*_incremental automatically add --fast-local-dev when calling

ninja -C out/Default base_unittests_incremental

For instrumentation tests:

ninja -C out/Default chrome_public_test_apk_incremental

To uninstall:

out/Default/bin/install_chrome_public_apk_incremental -v --uninstall


Rebuilding for a particular release

In the case where you want to modify the native code for an existing release of Chrome for Android (v25+) you can do the following steps. Note that in order to get your changes into the official release, you'll need to send your change for a codereview using the regular process for committing code to chromium.
  1. Open Chrome on your Android device and visit chrome://version
  2. Copy down the id listed next to "Build ID:"
  3. Go to
  4. Download the listed files and follow the steps in the README.