Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(544)

Side by Side Diff: docs/android_build_instructions.md

Issue 2536723008: Make some small tweaks to the build instructions. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | docs/ios_build_instructions.md » ('j') | docs/linux_arch_build_instructions.md » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Android Build Instructions 1 # Android Build Instructions
2 2
3 **See also [the old version of this page](old_android_build_instructions.md).** 3 **See also [the old version of this page](old_android_build_instructions.md).**
4 4
5 Google employee? See [go/building-chrome](https://goto.google.com/building-chrom e) instead. 5 Google employee? See [go/building-chrome](https://goto.google.com/building-chrom e) instead.
6 6
7 [TOC] 7 [TOC]
8 8
9 ## System requirements 9 ## System requirements
10 10
11 * A 64-bit Intel machine running Linux with at least 8GB of RAM. More 11 * A 64-bit Intel machine running Linux with at least 8GB of RAM. More
12 than 16GB is highly recommended. 12 than 16GB is highly recommended.
13 * At least 100GB of free disk space. 13 * At least 100GB of free disk space.
14 * You must have Git and Python installed already. 14 * You must have Git and Python installed already.
15 15
16 Most development is done on Ubuntu. Other distros may or may not work; 16 Most development is done on Ubuntu. Other distros may or may not work;
17 see the [linux instructions](linux_build_instructions.md) for some suggestions. 17 see the [Linux instructions](linux_build_instructions.md) for some suggestions.
18 18
19 Building the Android client on Windows or Mac is not supported and doesn't work. 19 Building the Android client on Windows or Mac is not supported and doesn't work.
20 20
21 ## Install `depot_tools` 21 ## Install `depot_tools`
22 22
23 Clone the depot_tools repository: 23 Clone the `depot_tools` repository:
24 24
25 $ git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git 25 ```shell
26 $ git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
27 ```
26 28
27 Add depot_tools to the end of your PATH (you will probably want to put this 29 Add `depot_tools` to the end of your PATH (you will probably want to put this
28 in your ~/.bashrc or ~/.zshrc). Assuming you cloned depot_tools 30 in your `~/.bashrc` or `~/.zshrc`). Assuming you cloned `depot_tools`
29 to /path/to/depot_tools: 31 to `/path/to/depot_tools`:
30 32
31 $ export PATH=$PATH:/path/to/depot_tools 33 ```shell
34 $ export PATH="$PATH:/path/to/depot_tools"
35 ```
32 36
33 ## Get the code 37 ## Get the code
34 38
35 Create a chromium directory for the checkout and change to it (you can call 39 Create a `chromium` directory for the checkout and change to it (you can call
36 this whatever you like and put it wherever you like, as 40 this whatever you like and put it wherever you like, as
37 long as the full path has no spaces): 41 long as the full path has no spaces):
38 42
39 $ mkdir ~/chromium && cd ~/chromium 43 ```shell
40 $ fetch --nohooks android 44 $ mkdir ~/chromium && cd ~/chromium
45 $ fetch --nohooks android
46 ```
41 47
42 If you don't want the full repo history, you can save a lot of time by 48 If you don't want the full repo history, you can save a lot of time by
43 adding the `--no-history` flag to fetch. 49 adding the `--no-history` flag to `fetch`.
44 50
45 Expect the command to take 30 minutes on even a fast connection, and many 51 Expect the command to take 30 minutes on even a fast connection, and many
46 hours on slower ones. 52 hours on slower ones.
47 53
48 If you've already installed the build dependencies on the machine (from another 54 If you've already installed the build dependencies on the machine (from another
49 checkout, for example), you can omit the `--nohooks` flag and fetch 55 checkout, for example), you can omit the `--nohooks` flag and `fetch`
50 will automatically execute `gclient runhooks` at the end. 56 will automatically execute `gclient runhooks` at the end.
51 57
52 When fetch completes, it will have created a directory called `src`. 58 When `fetch` completes, it will have created a hidden `.gclient` file and a
53 The remaining instructions assume you are now in that directory: 59 directory called `src` in the working directory. The remaining instructions
60 assume you are now in that directory:
Dirk Pranke 2016/11/30 23:40:20 Nit: maybe change this line (here and in the other
Sidney San Martín 2016/12/01 00:22:23 How does "assume you have switched to the `src` di
Dirk Pranke 2016/12/01 00:33:06 That sounds fine.
54 61
55 $ cd src 62 ```shell
63 $ cd src
64 ```
56 65
57 ### Converting an existing Linux checkout 66 ### Converting an existing Linux checkout
58 67
59 If you have an existing Linux checkout, you can add Android support by 68 If you have an existing Linux checkout, you can add Android support by
60 appending `target_os = ['android']` to your .gclient file (in the 69 appending `target_os = ['android']` to your `.gclient` file (in the
61 directory above src): 70 directory above `src`):
62 71
63 $ echo "target_os = [ 'android' ]" >> ../.gclient 72 ```shell
73 $ echo "target_os = [ 'android' ]" >> ../.gclient
74 ```
64 75
65 Then run gclient sync to pull the new Android dependencies: 76 Then run `gclient sync` to pull the new Android dependencies:
66 77
67 gclient sync 78 ```shell
79 $ gclient sync
80 ```
68 81
69 (This is actually the difference between `fetch android` and `fetch chromium`). 82 (This is the only difference between `fetch android` and `fetch chromium`.)
70 83
71 ### Install additional build dependencies 84 ### Install additional build dependencies
72 85
73 Once you have checked out the code, run 86 Once you have checked out the code, run
74 87
75 build/install-build-deps-android.sh 88 ```shell
89 $ build/install-build-deps-android.sh
90 ```
76 91
77 to get all of the dependencies you need to build on Linux *plus* all of the 92 to get all of the dependencies you need to build on Linux, *plus* all of the
78 Android-specific dependencies (you need some of the regular Linux dependencies 93 Android-specific dependencies (you need some of the regular Linux dependencies
79 because an Android build builds a bunch of the Linux tools and utilities). 94 because an Android build includes a bunch of the Linux tools and utilities).
80 95
81 ### Run the hooks 96 ### Run the hooks
82 97
83 Once you've run `install-build-deps` at least once, you can now run the 98 Once you've run `install-build-deps` at least once, you can now run the
84 chromium-specific hooks, which will download additional binaries and other 99 Chromium-specific hooks, which will download additional binaries and other
85 things you might need: 100 things you might need:
86 101
87 $ gclient runhooks 102 ```shell
103 $ gclient runhooks
104 ```
88 105
89 *Optional*: You can also [install API keys](https://www.chromium.org/developers/ how-tos/api-keys) 106 *Optional*: You can also [install API
90 if you want to talk to some of the Google services, but this is not necessary 107 keys](https://www.chromium.org/developers/how-tos/api-keys) if you want your
91 for most development and testing purposes. 108 build to talk to some Google services, but this is not necessary for most
109 development and testing purposes.
92 110
93 ### Configure the JDK 111 ### Configure the JDK
94 112
95 Make also sure that OpenJDK 1.7 is selected as default: 113 Make also sure that OpenJDK 1.7 is selected as default:
96 114
97 `sudo update-alternatives --config javac` 115 ```shell
98 `sudo update-alternatives --config java` 116 $ sudo update-alternatives --config javac
99 `sudo update-alternatives --config javaws` 117 $ sudo update-alternatives --config java
100 `sudo update-alternatives --config javap` 118 $ sudo update-alternatives --config javaws
101 `sudo update-alternatives --config jar` 119 $ sudo update-alternatives --config javap
102 `sudo update-alternatives --config jarsigner` 120 $ sudo update-alternatives --config jar
121 $ sudo update-alternatives --config jarsigner
122 ```
103 123
104 ## Setting up the Build 124 ## Setting up the Build
105 125
106 Chromium uses [Ninja](https://ninja-build.org) as its main build tool, and 126 Chromium uses [Ninja](https://ninja-build.org) as its main build tool along
107 a tool called [GN](../tools/gn/docs/quick_start.md) to generate 127 with a tool called [GN](../tools/gn/docs/quick_start.md) to generate `.ninja`
108 the .ninja files to do the build. To create a build directory configured 128 files. You can create any number of *build directories* with different
109 to build Android, run: 129 configurations. To create a build directory which builds Chrome for Android,
130 run:
110 131
111 $ gn gen '--args="target_os="android"' out/Default 132 ```shell
133 $ gn gen '--args="target_os="android"' out/Default
134 ```
112 135
113 * You only have to do run this command once, it will self-update the build 136 * You only have to do run this once for each new build directory, Ninja will
114 files as needed after that. 137 update the build files as needed.
115 * You can replace `out/Default` with another directory name, but we recommend 138 * You can replace `Default` with another name, but
116 it should still be a subdirectory of `out`. 139 it should be a subdirectory of `out`.
117 * To specify build parameters for GN builds, including release settings, 140 * For other build arguments, including release settings, see [GN build
118 see [GN build configuration](https://www.chromium.org/developers/gn-build-conf iguration). 141 configuration](https://www.chromium.org/developers/gn-build-configuration).
119 The default will be a debug component build matching the current host 142 The default will be a debug component build matching the current host
120 operating system and CPU. 143 operating system and CPU.
121 * For more info on GN, run `gn help` on the command line or read the 144 * For more info on GN, run `gn help` on the command line or read the
122 [quick start guide](../tools/gn/docs/quick_start.md). 145 [quick start guide](../tools/gn/docs/quick_start.md).
123 146
124 Also be aware that some scripts (e.g. tombstones.py, adb_gdb.py) 147 Also be aware that some scripts (e.g. `tombstones.py`, `adb_gdb.py`)
125 require you to set `CHROMIUM_OUTPUT_DIR=out/Default`. 148 require you to set `CHROMIUM_OUTPUT_DIR=out/Default`.
126 149
127 ## Build Chromium 150 ## Build Chromium
128 151
129 Build Chromium with Ninja using the command: 152 Build Chromium with Ninja using the command:
130 153
131 $ ninja -C out/Default chrome_public_apk 154 ```shell
155 $ ninja -C out/Default chrome_public_apk
156 ```
132 157
133 You can get a list of all of the other build targets from GN by running 158 You can get a list of all of the other build targets from GN by running `gn ls
134 `gn ls out/Default` from the command line. To compile one, pass to Ninja 159 out/Default` from the command line. To compile one, pass the GN label to Ninja
135 the GN label with no preceding "//" (so for `//chrome/test:unit_tests` 160 with no preceding "//" (so, for `//chrome/test:unit_tests` use `ninja -C
136 use ninja -C out/Default chrome/test:unit_tests`). 161 out/Default chrome/test:unit_tests`).
162
137 ## Installing and Running Chromium on a device 163 ## Installing and Running Chromium on a device
138 164
139 If the `adb_install_apk.py` script below fails, make sure aapt is in 165 If the `adb_install_apk.py` script below fails, make sure `aapt` is in your
140 your PATH. If not, add aapt's path to your PATH environment variable (it 166 PATH. If not, add `aapt`'s parent directory to your `PATH` environment variable
141 should be 167 (it should be
142 `/path/to/src/third_party/android_tools/sdk/build-tools/{latest_version}/`). 168 `/path/to/src/third_party/android_tools/sdk/build-tools/{latest_version}/`).
143 169
144 Prepare the environment: 170 Prepare the environment:
145 171
146 ```shell 172 ```shell
147 . build/android/envsetup.sh 173 $ . build/android/envsetup.sh
148 ``` 174 ```
149 175
150 ### Plug in your Android device 176 ### Plug in your Android device
151 177
152 Make sure your Android device is plugged in via USB, and USB Debugging 178 Make sure your Android device is plugged in via USB, and USB Debugging
153 is enabled. 179 is enabled.
154 180
155 To enable USB Debugging: 181 To enable USB Debugging:
156 182
157 * Navigate to Settings \> About Phone \> Build number 183 * Navigate to Settings \> About Phone \> Build number
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 release of Chrome for Android (v25+) you can do the following steps. 350 release of Chrome for Android (v25+) you can do the following steps.
325 Note that in order to get your changes into the official release, you'll 351 Note that in order to get your changes into the official release, you'll
326 need to send your change for a codereview using the regular process for 352 need to send your change for a codereview using the regular process for
327 committing code to chromium. 353 committing code to chromium.
328 354
329 1. Open Chrome on your Android device and visit chrome://version 355 1. Open Chrome on your Android device and visit chrome://version
330 2. Copy down the id listed next to "Build ID:" 356 2. Copy down the id listed next to "Build ID:"
331 3. Go to 357 3. Go to
332 [http://storage.googleapis.com/chrome-browser-components/BUILD\_ID\_FROM\_ST EP\_2/index.html](http://storage.googleapis.com/chrome-browser-components/BUILD_ ID_FROM_STEP_2/index.html) 358 [http://storage.googleapis.com/chrome-browser-components/BUILD\_ID\_FROM\_ST EP\_2/index.html](http://storage.googleapis.com/chrome-browser-components/BUILD_ ID_FROM_STEP_2/index.html)
333 4. Download the listed files and follow the steps in the README. 359 4. Download the listed files and follow the steps in the README.
OLDNEW
« no previous file with comments | « no previous file | docs/ios_build_instructions.md » ('j') | docs/linux_arch_build_instructions.md » ('J')

Powered by Google App Engine
This is Rietveld 408576698