blob: 2e1c7e02cd76bca4f6775bcc7c3c14f5e4731941 [file] [log] [blame] [view]
tfarina2c773222016-04-05 18:43:351# Android Build Instructions
2
3[TOC]
4
5## Prerequisites
6
7A Linux build machine capable of building [Chrome for
8Linux](https://chromium.googlesource.com/chromium/src/+/master/docs/linux_build_instructions_prerequisites.md).
9Other (Mac/Windows) platforms are not supported for Android.
10
11## Getting the code
12
13First, check out and install the [depot\_tools
14package](https://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/depot_tools_tutorial.html#_setting_up).
15
16Then, if you have no existing checkout, create your source directory and
17get the code:
18
19```shell
20mkdir ~/chromium && cd ~/chromium
21fetch --nohooks android # This will take 30 minutes on a fast connection
22```
23
24If you have an existing Linux checkout, you can add Android support by
25appending `target_os = ['android']` to your .gclient file (in the
26directory above src):
27
28```shell
29cat > .gclient <<EOF
30 solutions = [ ...existing stuff in here... ]
31 target_os = [ 'android' ] # Add this to get Android stuff checked out.
32EOF
33```
34
35Then run gclient sync to get the Android stuff checked out:
36
37```shell
38gclient sync
39```
40
41## (Optional) Check out LKGR
42
43If you want a single build of Chromium in a known good state, sync to
44the LKGR ("last known good revision"). You can find it
45[here](http://chromium-status.appspot.com/lkgr), and the last 100
46[here](http://chromium-status.appspot.com/revisions). Run:
47
48```shell
49gclient sync --nohooks -r <lkgr-sha1>
50```
51
52This is not needed for a typical developer workflow; only for one-time
53builds of Chromium.
54
55## Configure your build
56
57Android builds can be run with GN or GYP, though GN incremental builds
58are the fastest option and GN will soon be the only supported option.
59They are both meta-build systems that generate nina files for the
60Android build. Both builds are regularly tested on the build waterfall.
61
62### Configure GYP (deprecated -- use GN instead)
63
64If you are using GYP, next to the .gclient file, create a a file called
65'chromium.gyp_env' with the following contents:
66
67```shell
68echo "{ 'GYP_DEFINES': 'OS=android target_arch=arm', }" > chromium.gyp_env
69```
70
71Note that "arm" is the default architecture and can be omitted. If
72building for x86 or MIPS devices, change `target_arch` to "ia32" or
73"mipsel".
74
75 **NOTE:** If you are using the `GYP_DEFINES` environment variable, it
76will override any settings in this file. Either clear it or set it to
77the values above before running `gclient runhooks`.