Chromium Code Reviews| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 68 echo "{ 'GYP_DEFINES': 'OS=android target_arch=arm', }" > chromium.gyp_env | 68 echo "{ 'GYP_DEFINES': 'OS=android target_arch=arm', }" > chromium.gyp_env |
| 69 ``` | 69 ``` |
| 70 | 70 |
| 71 Note that "arm" is the default architecture and can be omitted. If | 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 | 72 building for x86 or MIPS devices, change `target_arch` to "ia32" or |
| 73 "mipsel". | 73 "mipsel". |
| 74 | 74 |
| 75 **NOTE:** If you are using the `GYP_DEFINES` environment variable, it | 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 | 76 will override any settings in this file. Either clear it or set it to |
| 77 the values above before running `gclient runhooks`. | 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 | |
| 98 ```shell | |
| 99 gn args out/Default | |
| 100 ``` | |
| 101 | |
| 102 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 | |
| 104 they may conflict with GYP builds. | |
| 105 | |
| 106 Also be aware that some scripts (e.g. tombstones.py, adb_gdb.py) | |
| 107 require you to set `CHROMIUM_OUTPUT_DIR=out/Default`. | |
| 108 | |
| 109 This command will bring up your editor with the GN build args. In this | |
| 110 file add: | |
| 111 | |
| 112 ``` | |
| 113 target_os = "android" | |
| 114 target_cpu = "arm" # (default) | |
| 115 is_debug = true # (default) | |
| 116 | |
| 117 # Other args you may want to set: | |
| 118 is_component_build = true | |
| 119 is_clang = true | |
| 120 symbol_level = 1 # Faster build with fewer symbols. -g1 rather than -g2 | |
| 121 enable_incremental_javac = true # Much faster; experimental | |
| 122 [symbol_level](https://code.google.com/p/chromium/codesearch#search/&q=file:buil d.*build.gn%20symbol_level&sq=package:chromium&type=cs) | |
|
newt (away)
2016/04/06 20:41:16
Does this link inside a code section work? It didn
tfarina
2016/04/07 15:01:24
It doesn't. I didn't work on dillinger.io as well.
| |
| 123 = 1 # Faster build with fewer symbols. -g1 rather than -g2 | |
| 124 enable_incremental_javac = true # Much faster; experimental | |
| 125 ``` | |
| 126 | |
| 127 You can also specify `target_cpu` values of "x86" and "mipsel". Re-run | |
| 128 gn args on that directory to edit the flags in the future. See the [GN | |
| 129 build | |
| 130 configuration](https://www.chromium.org/developers/gn-build-configuration) | |
| 131 page for other flags you may want to set. | |
| 132 | |
| 133 ### Install build dependencies | |
| 134 | |
| 135 Update the system packages required to build by running: | |
| 136 | |
| 137 ```shell | |
| 138 ./build/install-build-deps-android.sh | |
| 139 ``` | |
| 140 | |
| 141 Make also sure that OpenJDK 1.7 is selected as default: | |
| 142 | |
| 143 `sudo update-alternatives --config javac` | |
| 144 `sudo update-alternatives --config java` | |
| 145 `sudo update-alternatives --config javaws` | |
| 146 `sudo update-alternatives --config javap` | |
| 147 `sudo update-alternatives --config jar` | |
| 148 `sudo update-alternatives --config jarsigner` | |
| 149 | |
| 150 ### Synchronize sub-directories. | |
| 151 | |
| 152 ```shell | |
| 153 gclient sync | |
| 154 ``` | |
| 155 | |
| 156 ## Build and install the APKs | |
| 157 | |
| 158 If the `adb_install_apk.py` script below fails, make sure aapt is in | |
| 159 your PATH. If not, add aapt's path to your PATH environment variable (it | |
| 160 should be | |
| 161 `/path/to/src/third_party/android_tools/sdk/build-tools/{latest_version}/`). | |
| 162 | |
| 163 Prepare the environment: | |
| 164 | |
| 165 ```shell | |
| 166 . build/android/envsetup.sh | |
| 167 ``` | |
| 168 | |
| 169 ### Plug in your Android device | |
| 170 | |
| 171 Make sure your Android device is plugged in via USB, and USB Debugging | |
| 172 is enabled. | |
| 173 | |
| 174 To enable USB Debugging: | |
| 175 | |
| 176 * Navigate to Settings \> About Phone \> Build number | |
| 177 * Click 'Build number' 7 times | |
| 178 * Now navigate back to Settings \> Developer Options | |
| 179 * Enable 'USB Debugging' and follow the prompts | |
| 180 | |
| 181 You may also be prompted to allow access to your PC once your device is | |
| 182 plugged in. | |
| 183 | |
| 184 You can check if the device is connected by running: | |
| 185 | |
| 186 ```shell | |
| 187 third_party/android_tools/sdk/platform-tools/adb devices | |
| 188 ``` | |
| 189 | |
| 190 Which prints a list of connected devices. If not connected, try | |
| 191 unplugging and reattaching your device. | |
| OLD | NEW |