| OLD | NEW |
| 1 # Android Build Instructions | 1 # Android Build Instructions |
| 2 | 2 |
| 3 [TOC] | 3 [TOC] |
| 4 | 4 |
| 5 ## Prerequisites | 5 ## Prerequisites |
| 6 | 6 |
| 7 A Linux build machine capable of building [Chrome for | 7 A Linux build machine capable of building [Chrome for |
| 8 Linux](https://chromium.googlesource.com/chromium/src/+/master/docs/linux_build_
instructions_prerequisites.md). | 8 Linux](https://chromium.googlesource.com/chromium/src/+/master/docs/linux_build_
instructions_prerequisites.md). |
| 9 Other (Mac/Windows) platforms are not supported for Android. | 9 Other (Mac/Windows) platforms are not supported for Android. |
| 10 | 10 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 [here](http://chromium-status.appspot.com/lkgr), and the last 100 | 45 [here](http://chromium-status.appspot.com/lkgr), and the last 100 |
| 46 [here](http://chromium-status.appspot.com/revisions). Run: | 46 [here](http://chromium-status.appspot.com/revisions). Run: |
| 47 | 47 |
| 48 ```shell | 48 ```shell |
| 49 gclient sync --nohooks -r <lkgr-sha1> | 49 gclient sync --nohooks -r <lkgr-sha1> |
| 50 ``` | 50 ``` |
| 51 | 51 |
| 52 This is not needed for a typical developer workflow; only for one-time | 52 This is not needed for a typical developer workflow; only for one-time |
| 53 builds of Chromium. | 53 builds of Chromium. |
| 54 | 54 |
| 55 ## Configure your build | 55 ## Configure GN |
| 56 | 56 |
| 57 Android builds can be run with GN or GYP, though GN incremental builds | 57 Create a build directory and set the build flags with: |
| 58 are the fastest option and GN will soon be the only supported option. | |
| 59 They are both meta-build systems that generate nina files for the | |
| 60 Android build. Both builds are regularly tested on the build waterfall. | |
| 61 | |
| 62 ### Configure GYP (deprecated -- use GN instead) | |
| 63 | |
| 64 If 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 | |
| 68 echo "{ 'GYP_DEFINES': 'OS=android target_arch=arm', }" > chromium.gyp_env | |
| 69 ``` | |
| 70 | |
| 71 Note that "arm" is the default architecture and can be omitted. If | |
| 72 building 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 | |
| 76 will override any settings in this file. Either clear it or set it to | |
| 77 the values above before running `gclient runhooks`. | |
| 78 | |
| 79 See | |
| 80 [build/android/developer\_recommended\_flags.gypi](https://code.google.com/p/chr
omium/codesearch#chromium/src/build/android/developer_recommended_flags.gypi&sq=
package:chromium&type=cs&q=file:android/developer_recommended_flags.gypi&l=1) | |
| 81 for other recommended GYP settings. | |
| 82 Once chromium.gyp_env is ready, you need to run the following command | |
| 83 to update projects from gyp files. You may need to run this again when | |
| 84 you have added new files, updated gyp files, or sync'ed your | |
| 85 repository. | |
| 86 | |
| 87 ```shell | |
| 88 gclient runhooks | |
| 89 ``` | |
| 90 | |
| 91 #### This will download more things and prompt you to accept Terms of Service fo
r Android SDK packages. | |
| 92 | |
| 93 ## Configure GN (recommended) | |
| 94 | |
| 95 If you are using GN, create a build directory and set the build flags | |
| 96 with: | |
| 97 | 58 |
| 98 ```shell | 59 ```shell |
| 99 gn args out/Default | 60 gn args out/Default |
| 100 ``` | 61 ``` |
| 101 | 62 |
| 102 You can replace out/Default with another name you choose inside the out | 63 You can replace out/Default with another name you choose inside the out |
| 103 directory. Do not use GYP's out/Debug or out/Release directories, as | 64 directory. |
| 104 they may conflict with GYP builds. | |
| 105 | 65 |
| 106 Also be aware that some scripts (e.g. tombstones.py, adb_gdb.py) | 66 Also be aware that some scripts (e.g. tombstones.py, adb_gdb.py) |
| 107 require you to set `CHROMIUM_OUTPUT_DIR=out/Default`. | 67 require you to set `CHROMIUM_OUTPUT_DIR=out/Default`. |
| 108 | 68 |
| 109 This command will bring up your editor with the GN build args. In this | 69 This command will bring up your editor with the GN build args. In this |
| 110 file add: | 70 file add: |
| 111 | 71 |
| 112 ``` | 72 ``` |
| 113 target_os = "android" | 73 target_os = "android" |
| 114 target_cpu = "arm" # (default) | 74 target_cpu = "arm" # (default) |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 | 144 |
| 185 ```shell | 145 ```shell |
| 186 third_party/android_tools/sdk/platform-tools/adb devices | 146 third_party/android_tools/sdk/platform-tools/adb devices |
| 187 ``` | 147 ``` |
| 188 | 148 |
| 189 Which prints a list of connected devices. If not connected, try | 149 Which prints a list of connected devices. If not connected, try |
| 190 unplugging and reattaching your device. | 150 unplugging and reattaching your device. |
| 191 | 151 |
| 192 ### Build the full browser | 152 ### Build the full browser |
| 193 | 153 |
| 194 **Note: When adding new resource files or java files in gyp builds, you | |
| 195 need to run 'gclient runhooks' again to get them in the build.** | |
| 196 | |
| 197 ```shell | 154 ```shell |
| 198 ninja -C out/Release chrome_public_apk | 155 ninja -C out/Release chrome_public_apk |
| 199 ``` | 156 ``` |
| 200 | 157 |
| 201 And deploy it to your Android device: | 158 And deploy it to your Android device: |
| 202 | 159 |
| 203 ```shell | 160 ```shell |
| 204 build/android/adb_install_apk.py out/Release/apks/ChromePublic.apk # For gyp. | |
| 205 CHROMIUM_OUTPUT_DIR=$gndir build/android/adb_install_apk.py $gndir/apks/ChromePu
blic.apk # for gn. | 161 CHROMIUM_OUTPUT_DIR=$gndir build/android/adb_install_apk.py $gndir/apks/ChromePu
blic.apk # for gn. |
| 206 ``` | 162 ``` |
| 207 | 163 |
| 208 The app will appear on the device as "Chromium". | 164 The app will appear on the device as "Chromium". |
| 209 | 165 |
| 210 ### Build Content shell | 166 ### Build Content shell |
| 211 | 167 |
| 212 Wraps the content module (but not the /chrome embedder). See | 168 Wraps the content module (but not the /chrome embedder). See |
| 213 [http://www.chromium.org/developers/content-module](http://www.chromium.org/deve
lopers/content-module) | 169 [http://www.chromium.org/developers/content-module](http://www.chromium.org/deve
lopers/content-module) |
| 214 for details on the content module and content shell. | 170 for details on the content module and content shell. |
| 215 | 171 |
| 216 ```shell | 172 ```shell |
| 217 ninja -C out/Release content_shell_apk | 173 ninja -C out/Release content_shell_apk |
| 218 build/android/adb_install_apk.py out/Release/apks/ContentShell.apk | 174 build/android/adb_install_apk.py out/Release/apks/ContentShell.apk |
| 219 ``` | 175 ``` |
| 220 | 176 |
| 221 this will build and install an Android apk under | 177 this will build and install an Android apk under |
| 222 `out/Release/apks/ContentShell.apk`. For GYP, replace `Release` with `Debug` | 178 `out/Release/apks/ContentShell.apk`. (Where `Release` is the name of your build |
| 223 above if you want to generate a Debug app. If you are using GN, substitute the | 179 directory.) |
| 224 name you initially gave to your build directory. | |
| 225 | 180 |
| 226 If you use custom out dir instead of standard out/ dir, use | 181 If you use custom out dir instead of standard out/ dir, use |
| 227 CHROMIUM_OUT_DIR env. | 182 CHROMIUM_OUT_DIR env. |
| 228 | 183 |
| 229 ```shell | 184 ```shell |
| 230 export CHROMIUM_OUT_DIR=out_android | 185 export CHROMIUM_OUT_DIR=out_android |
| 231 ``` | 186 ``` |
| 232 | 187 |
| 233 ### Build WebView shell | 188 ### Build WebView shell |
| 234 | 189 |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 release of Chrome for Android (v25+) you can do the following steps. | 302 release of Chrome for Android (v25+) you can do the following steps. |
| 348 Note that in order to get your changes into the official release, you'll | 303 Note that in order to get your changes into the official release, you'll |
| 349 need to send your change for a codereview using the regular process for | 304 need to send your change for a codereview using the regular process for |
| 350 committing code to chromium. | 305 committing code to chromium. |
| 351 | 306 |
| 352 1. Open Chrome on your Android device and visit chrome://version | 307 1. Open Chrome on your Android device and visit chrome://version |
| 353 2. Copy down the id listed next to "Build ID:" | 308 2. Copy down the id listed next to "Build ID:" |
| 354 3. Go to | 309 3. Go to |
| 355 [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) | 310 [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) |
| 356 4. Download the listed files and follow the steps in the README. | 311 4. Download the listed files and follow the steps in the README. |
| OLD | NEW |