dpranke | 1a70d0c | 2016-12-01 02:42:29 | [diff] [blame] | 1 | # Checking out and building Chromium for Android |
| 2 | |
estevenson | 75e9b86 | 2017-01-05 16:49:23 | [diff] [blame] | 3 | There are instructions for other platforms linked from the |
dpranke | 1a70d0c | 2016-12-01 02:42:29 | [diff] [blame] | 4 | [get the code](get_the_code.md) page. |
tfarina | 2c77322 | 2016-04-05 18:43:35 | [diff] [blame] | 5 | |
dpranke | 1a70d0c | 2016-12-01 02:42:29 | [diff] [blame] | 6 | ## Instructions for Google Employees |
| 7 | |
| 8 | Are you a Google employee? See |
| 9 | [go/building-chrome](https://goto.google.com/building-chrome) instead. |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 10 | |
tfarina | 2c77322 | 2016-04-05 18:43:35 | [diff] [blame] | 11 | [TOC] |
| 12 | |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 13 | ## System requirements |
tfarina | 2c77322 | 2016-04-05 18:43:35 | [diff] [blame] | 14 | |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 15 | * A 64-bit Intel machine running Linux with at least 8GB of RAM. More |
| 16 | than 16GB is highly recommended. |
| 17 | * At least 100GB of free disk space. |
| 18 | * You must have Git and Python installed already. |
tfarina | 2c77322 | 2016-04-05 18:43:35 | [diff] [blame] | 19 | |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 20 | Most development is done on Ubuntu. Other distros may or may not work; |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 21 | see the [Linux instructions](linux_build_instructions.md) for some suggestions. |
tfarina | 2c77322 | 2016-04-05 18:43:35 | [diff] [blame] | 22 | |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 23 | Building the Android client on Windows or Mac is not supported and doesn't work. |
tfarina | 2c77322 | 2016-04-05 18:43:35 | [diff] [blame] | 24 | |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 25 | ## Install `depot_tools` |
tfarina | 2c77322 | 2016-04-05 18:43:35 | [diff] [blame] | 26 | |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 27 | Clone the `depot_tools` repository: |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 28 | |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 29 | ```shell |
Andrew Grieve | c81af4a | 2017-07-26 18:02:13 | [diff] [blame] | 30 | git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 31 | ``` |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 32 | |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 33 | Add `depot_tools` to the end of your PATH (you will probably want to put this |
| 34 | in your `~/.bashrc` or `~/.zshrc`). Assuming you cloned `depot_tools` |
| 35 | to `/path/to/depot_tools`: |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 36 | |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 37 | ```shell |
Andrew Grieve | c81af4a | 2017-07-26 18:02:13 | [diff] [blame] | 38 | export PATH="$PATH:/path/to/depot_tools" |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 39 | ``` |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 40 | |
| 41 | ## Get the code |
| 42 | |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 43 | Create a `chromium` directory for the checkout and change to it (you can call |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 44 | this whatever you like and put it wherever you like, as |
| 45 | long as the full path has no spaces): |
| 46 | |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 47 | ```shell |
Andrew Grieve | c81af4a | 2017-07-26 18:02:13 | [diff] [blame] | 48 | mkdir ~/chromium && cd ~/chromium |
| 49 | fetch --nohooks android |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 50 | ``` |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 51 | |
| 52 | If you don't want the full repo history, you can save a lot of time by |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 53 | adding the `--no-history` flag to `fetch`. |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 54 | |
| 55 | Expect the command to take 30 minutes on even a fast connection, and many |
| 56 | hours on slower ones. |
| 57 | |
| 58 | If you've already installed the build dependencies on the machine (from another |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 59 | checkout, for example), you can omit the `--nohooks` flag and `fetch` |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 60 | will automatically execute `gclient runhooks` at the end. |
| 61 | |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 62 | When `fetch` completes, it will have created a hidden `.gclient` file and a |
| 63 | directory called `src` in the working directory. The remaining instructions |
| 64 | assume you have switched to the `src` directory: |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 65 | |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 66 | ```shell |
Andrew Grieve | c81af4a | 2017-07-26 18:02:13 | [diff] [blame] | 67 | cd src |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 68 | ``` |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 69 | |
| 70 | ### Converting an existing Linux checkout |
tfarina | 2c77322 | 2016-04-05 18:43:35 | [diff] [blame] | 71 | |
| 72 | If you have an existing Linux checkout, you can add Android support by |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 73 | appending `target_os = ['android']` to your `.gclient` file (in the |
| 74 | directory above `src`): |
tfarina | 2c77322 | 2016-04-05 18:43:35 | [diff] [blame] | 75 | |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 76 | ```shell |
Andrew Grieve | c81af4a | 2017-07-26 18:02:13 | [diff] [blame] | 77 | echo "target_os = [ 'android' ]" >> ../.gclient |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 78 | ``` |
tfarina | 2c77322 | 2016-04-05 18:43:35 | [diff] [blame] | 79 | |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 80 | Then run `gclient sync` to pull the new Android dependencies: |
tfarina | 2c77322 | 2016-04-05 18:43:35 | [diff] [blame] | 81 | |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 82 | ```shell |
Andrew Grieve | c81af4a | 2017-07-26 18:02:13 | [diff] [blame] | 83 | gclient sync |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 84 | ``` |
tfarina | 2c77322 | 2016-04-05 18:43:35 | [diff] [blame] | 85 | |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 86 | (This is the only difference between `fetch android` and `fetch chromium`.) |
tfarina | 2c77322 | 2016-04-05 18:43:35 | [diff] [blame] | 87 | |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 88 | ### Install additional build dependencies |
tfarina | 2c77322 | 2016-04-05 18:43:35 | [diff] [blame] | 89 | |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 90 | Once you have checked out the code, run |
tfarina | 2c77322 | 2016-04-05 18:43:35 | [diff] [blame] | 91 | |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 92 | ```shell |
Andrew Grieve | c81af4a | 2017-07-26 18:02:13 | [diff] [blame] | 93 | build/install-build-deps-android.sh |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 94 | ``` |
tfarina | 2c77322 | 2016-04-05 18:43:35 | [diff] [blame] | 95 | |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 96 | to get all of the dependencies you need to build on Linux, *plus* all of the |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 97 | Android-specific dependencies (you need some of the regular Linux dependencies |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 98 | because an Android build includes a bunch of the Linux tools and utilities). |
tfarina | 2c77322 | 2016-04-05 18:43:35 | [diff] [blame] | 99 | |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 100 | ### Run the hooks |
tfarina | ba2792fa | 2016-04-07 15:50:42 | [diff] [blame] | 101 | |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 102 | Once you've run `install-build-deps` at least once, you can now run the |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 103 | Chromium-specific hooks, which will download additional binaries and other |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 104 | things you might need: |
tfarina | ba2792fa | 2016-04-07 15:50:42 | [diff] [blame] | 105 | |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 106 | ```shell |
Andrew Grieve | c81af4a | 2017-07-26 18:02:13 | [diff] [blame] | 107 | gclient runhooks |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 108 | ``` |
tfarina | ba2792fa | 2016-04-07 15:50:42 | [diff] [blame] | 109 | |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 110 | *Optional*: You can also [install API |
| 111 | keys](https://www.chromium.org/developers/how-tos/api-keys) if you want your |
| 112 | build to talk to some Google services, but this is not necessary for most |
| 113 | development and testing purposes. |
tfarina | ba2792fa | 2016-04-07 15:50:42 | [diff] [blame] | 114 | |
dpranke | 1a70d0c | 2016-12-01 02:42:29 | [diff] [blame] | 115 | ## Setting up the build |
tfarina | ba2792fa | 2016-04-07 15:50:42 | [diff] [blame] | 116 | |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 117 | Chromium uses [Ninja](https://ninja-build.org) as its main build tool along |
| 118 | with a tool called [GN](../tools/gn/docs/quick_start.md) to generate `.ninja` |
| 119 | files. You can create any number of *build directories* with different |
| 120 | configurations. To create a build directory which builds Chrome for Android, |
| 121 | run: |
tfarina | ba2792fa | 2016-04-07 15:50:42 | [diff] [blame] | 122 | |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 123 | ```shell |
Andrew Grieve | c81af4a | 2017-07-26 18:02:13 | [diff] [blame] | 124 | gn gen --args='target_os="android"' out/Default |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 125 | ``` |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 126 | |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 127 | * You only have to run this once for each new build directory, Ninja will |
| 128 | update the build files as needed. |
| 129 | * You can replace `Default` with another name, but |
| 130 | it should be a subdirectory of `out`. |
| 131 | * For other build arguments, including release settings, see [GN build |
| 132 | configuration](https://www.chromium.org/developers/gn-build-configuration). |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 133 | The default will be a debug component build matching the current host |
| 134 | operating system and CPU. |
| 135 | * For more info on GN, run `gn help` on the command line or read the |
| 136 | [quick start guide](../tools/gn/docs/quick_start.md). |
| 137 | |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 138 | Also be aware that some scripts (e.g. `tombstones.py`, `adb_gdb.py`) |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 139 | require you to set `CHROMIUM_OUTPUT_DIR=out/Default`. |
| 140 | |
| 141 | ## Build Chromium |
| 142 | |
| 143 | Build Chromium with Ninja using the command: |
| 144 | |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 145 | ```shell |
Andrew Grieve | c81af4a | 2017-07-26 18:02:13 | [diff] [blame] | 146 | ninja -C out/Default chrome_public_apk |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 147 | ``` |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 148 | |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 149 | You can get a list of all of the other build targets from GN by running `gn ls |
| 150 | out/Default` from the command line. To compile one, pass the GN label to Ninja |
| 151 | with no preceding "//" (so, for `//chrome/test:unit_tests` use `ninja -C |
| 152 | out/Default chrome/test:unit_tests`). |
| 153 | |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 154 | ## Installing and Running Chromium on a device |
tfarina | ba2792fa | 2016-04-07 15:50:42 | [diff] [blame] | 155 | |
tfarina | ba2792fa | 2016-04-07 15:50:42 | [diff] [blame] | 156 | Prepare the environment: |
| 157 | |
| 158 | ```shell |
Andrew Grieve | c81af4a | 2017-07-26 18:02:13 | [diff] [blame] | 159 | . build/android/envsetup.sh |
tfarina | ba2792fa | 2016-04-07 15:50:42 | [diff] [blame] | 160 | ``` |
| 161 | |
| 162 | ### Plug in your Android device |
| 163 | |
| 164 | Make sure your Android device is plugged in via USB, and USB Debugging |
| 165 | is enabled. |
| 166 | |
| 167 | To enable USB Debugging: |
| 168 | |
| 169 | * Navigate to Settings \> About Phone \> Build number |
| 170 | * Click 'Build number' 7 times |
| 171 | * Now navigate back to Settings \> Developer Options |
| 172 | * Enable 'USB Debugging' and follow the prompts |
| 173 | |
| 174 | You may also be prompted to allow access to your PC once your device is |
| 175 | plugged in. |
| 176 | |
| 177 | You can check if the device is connected by running: |
| 178 | |
| 179 | ```shell |
| 180 | third_party/android_tools/sdk/platform-tools/adb devices |
| 181 | ``` |
| 182 | |
| 183 | Which prints a list of connected devices. If not connected, try |
| 184 | unplugging and reattaching your device. |
tfarina | a68eb90 | 2016-04-12 19:43:05 | [diff] [blame] | 185 | |
| 186 | ### Build the full browser |
| 187 | |
tfarina | a68eb90 | 2016-04-12 19:43:05 | [diff] [blame] | 188 | ```shell |
Yipeng Wang | fd7db17 | 2017-04-25 17:27:18 | [diff] [blame] | 189 | ninja -C out/Default chrome_public_apk |
tfarina | a68eb90 | 2016-04-12 19:43:05 | [diff] [blame] | 190 | ``` |
| 191 | |
| 192 | And deploy it to your Android device: |
| 193 | |
| 194 | ```shell |
Andrew Grieve | c81af4a | 2017-07-26 18:02:13 | [diff] [blame] | 195 | out/Default/bin/chrome_public_apk install |
tfarina | a68eb90 | 2016-04-12 19:43:05 | [diff] [blame] | 196 | ``` |
| 197 | |
| 198 | The app will appear on the device as "Chromium". |
| 199 | |
| 200 | ### Build Content shell |
| 201 | |
| 202 | Wraps the content module (but not the /chrome embedder). See |
xiaoyin.l | 1003c0b | 2016-12-06 02:51:17 | [diff] [blame] | 203 | [https://www.chromium.org/developers/content-module](https://www.chromium.org/developers/content-module) |
tfarina | a68eb90 | 2016-04-12 19:43:05 | [diff] [blame] | 204 | for details on the content module and content shell. |
| 205 | |
| 206 | ```shell |
Yipeng Wang | fd7db17 | 2017-04-25 17:27:18 | [diff] [blame] | 207 | ninja -C out/Default content_shell_apk |
Andrew Grieve | c81af4a | 2017-07-26 18:02:13 | [diff] [blame] | 208 | out/Default/bin/content_shell_apk install |
tfarina | a68eb90 | 2016-04-12 19:43:05 | [diff] [blame] | 209 | ``` |
| 210 | |
| 211 | this will build and install an Android apk under |
Yipeng Wang | 613ba69 | 2017-04-25 18:24:39 | [diff] [blame] | 212 | `out/Default/apks/ContentShell.apk`. |
tfarina | a68eb90 | 2016-04-12 19:43:05 | [diff] [blame] | 213 | |
ntfschr | 29a7adab | 2017-03-23 21:17:08 | [diff] [blame] | 214 | ### Build WebView |
tfarina | a68eb90 | 2016-04-12 19:43:05 | [diff] [blame] | 215 | |
xiaoyin.l | 1003c0b | 2016-12-06 02:51:17 | [diff] [blame] | 216 | [Android WebView](https://developer.android.com/reference/android/webkit/WebView.html) |
tfarina | a68eb90 | 2016-04-12 19:43:05 | [diff] [blame] | 217 | is a system framework component. Since Android KitKat, it is implemented using |
xiaoyin.l | 1003c0b | 2016-12-06 02:51:17 | [diff] [blame] | 218 | Chromium code (based off the [content module](https://dev.chromium.org/developers/content-module)). |
tfarina | a68eb90 | 2016-04-12 19:43:05 | [diff] [blame] | 219 | |
ntfschr | 29a7adab | 2017-03-23 21:17:08 | [diff] [blame] | 220 | If you want to build the complete Android WebView framework component and test |
| 221 | the effect of your chromium changes in Android apps using WebView, you should |
| 222 | follow the [Android AOSP + chromium WebView |
| 223 | instructions](https://www.chromium.org/developers/how-tos/build-instructions-android-webview) |
tfarina | a68eb90 | 2016-04-12 19:43:05 | [diff] [blame] | 224 | |
| 225 | ### Running |
| 226 | |
tfarina | a68eb90 | 2016-04-12 19:43:05 | [diff] [blame] | 227 | For Content shell: |
| 228 | |
| 229 | ```shell |
Andrew Grieve | c81af4a | 2017-07-26 18:02:13 | [diff] [blame] | 230 | out/Default/bin/content_shell_apk launch [--args='--foo --bar'] http://example.com |
tfarina | a68eb90 | 2016-04-12 19:43:05 | [diff] [blame] | 231 | ``` |
| 232 | |
| 233 | For Chrome public: |
| 234 | |
| 235 | ```shell |
Andrew Grieve | c81af4a | 2017-07-26 18:02:13 | [diff] [blame] | 236 | out/Default/bin/chrome_public_apk launch [--args='--foo --bar'] http://example.com |
tfarina | a68eb90 | 2016-04-12 19:43:05 | [diff] [blame] | 237 | ``` |
| 238 | |
tfarina | a68eb90 | 2016-04-12 19:43:05 | [diff] [blame] | 239 | ### Logging and debugging |
| 240 | |
| 241 | Logging is often the easiest way to understand code flow. In C++ you can print |
Andrew Grieve | c81af4a | 2017-07-26 18:02:13 | [diff] [blame] | 242 | log statements using the LOG macro. In Java, refer to |
| 243 | [android_logging.md](android_logging.md). |
tfarina | a68eb90 | 2016-04-12 19:43:05 | [diff] [blame] | 244 | |
Andrew Grieve | c81af4a | 2017-07-26 18:02:13 | [diff] [blame] | 245 | You can see these log via `adb logcat`, or: |
tfarina | a68eb90 | 2016-04-12 19:43:05 | [diff] [blame] | 246 | |
| 247 | ```shell |
Andrew Grieve | c81af4a | 2017-07-26 18:02:13 | [diff] [blame] | 248 | out/Default/bin/chrome_public_apk logcat |
tfarina | a68eb90 | 2016-04-12 19:43:05 | [diff] [blame] | 249 | ``` |
| 250 | |
Andrew Grieve | c81af4a | 2017-07-26 18:02:13 | [diff] [blame] | 251 | To debug C++ code, use one of the following commands: |
tfarina | a68eb90 | 2016-04-12 19:43:05 | [diff] [blame] | 252 | |
| 253 | ```shell |
Andrew Grieve | c81af4a | 2017-07-26 18:02:13 | [diff] [blame] | 254 | out/Default/bin/content_shell_apk gdb |
| 255 | out/Default/bin/chrome_public_apk gdb |
tfarina | a68eb90 | 2016-04-12 19:43:05 | [diff] [blame] | 256 | ``` |
| 257 | |
Philip Jägenstedt | 17f8996 | 2017-05-18 08:25:54 | [diff] [blame] | 258 | See [Android Debugging Instructions](android_debugging_instructions.md) |
tfarina | a68eb90 | 2016-04-12 19:43:05 | [diff] [blame] | 259 | for more on debugging, including how to debug Java code. |
| 260 | |
| 261 | ### Testing |
| 262 | |
Philip Jägenstedt | 17f8996 | 2017-05-18 08:25:54 | [diff] [blame] | 263 | For information on running tests, see [Android Test Instructions](android_test_instructions.md). |
tfarina | a68eb90 | 2016-04-12 19:43:05 | [diff] [blame] | 264 | |
Andrew Grieve | c81af4a | 2017-07-26 18:02:13 | [diff] [blame] | 265 | ### Faster Edit/Deploy |
tfarina | a68eb90 | 2016-04-12 19:43:05 | [diff] [blame] | 266 | |
Andrew Grieve | c81af4a | 2017-07-26 18:02:13 | [diff] [blame] | 267 | "Incremental install" uses reflection and side-loading to speed up the edit |
estevenson | 75e9b86 | 2017-01-05 16:49:23 | [diff] [blame] | 268 | & deploy cycle (normally < 10 seconds). The initial launch of the apk will be |
| 269 | a little slower since updated dex files are installed manually. |
tfarina | a68eb90 | 2016-04-12 19:43:05 | [diff] [blame] | 270 | |
| 271 | * Make sure to set` is_component_build = true `in your GN args |
| 272 | * All apk targets have \*`_incremental` targets defined (e.g. |
estevenson | 75e9b86 | 2017-01-05 16:49:23 | [diff] [blame] | 273 | `chrome_public_apk_incremental`) except for Webview and Monochrome |
tfarina | a68eb90 | 2016-04-12 19:43:05 | [diff] [blame] | 274 | |
| 275 | Here's an example: |
| 276 | |
| 277 | ```shell |
| 278 | ninja -C out/Default chrome_public_apk_incremental |
Andrew Grieve | c81af4a | 2017-07-26 18:02:13 | [diff] [blame] | 279 | out/Default/bin/chrome_public_apk install --incremental --verbose |
tfarina | a68eb90 | 2016-04-12 19:43:05 | [diff] [blame] | 280 | ``` |
| 281 | |
| 282 | For gunit tests (note that run_*_incremental automatically add |
Andrew Grieve | c81af4a | 2017-07-26 18:02:13 | [diff] [blame] | 283 | `--fast-local-dev` when calling `test_runner.py`): |
tfarina | a68eb90 | 2016-04-12 19:43:05 | [diff] [blame] | 284 | |
| 285 | ```shell |
| 286 | ninja -C out/Default base_unittests_incremental |
| 287 | out/Default/bin/run_base_unittests_incremental |
| 288 | ``` |
| 289 | |
| 290 | For instrumentation tests: |
| 291 | |
| 292 | ```shell |
| 293 | ninja -C out/Default chrome_public_test_apk_incremental |
| 294 | out/Default/bin/run_chrome_public_test_apk_incremental |
| 295 | ``` |
| 296 | |
| 297 | To uninstall: |
| 298 | |
| 299 | ```shell |
Andrew Grieve | c81af4a | 2017-07-26 18:02:13 | [diff] [blame] | 300 | out/Default/bin/chrome_public_apk uninstall |
tfarina | a68eb90 | 2016-04-12 19:43:05 | [diff] [blame] | 301 | ``` |
| 302 | |
Andrew Grieve | c81af4a | 2017-07-26 18:02:13 | [diff] [blame] | 303 | To avoid typing `_incremental` when building targets, you can use the GN arg: |
estevenson | 75e9b86 | 2017-01-05 16:49:23 | [diff] [blame] | 304 | |
Andrew Grieve | c81af4a | 2017-07-26 18:02:13 | [diff] [blame] | 305 | ``` |
| 306 | incremental_apk_by_default = true |
estevenson | 75e9b86 | 2017-01-05 16:49:23 | [diff] [blame] | 307 | ``` |
| 308 | |
Andrew Grieve | c81af4a | 2017-07-26 18:02:13 | [diff] [blame] | 309 | This will make `chrome_public_apk` build in incremental mode. |
| 310 | |
estevenson | 75e9b86 | 2017-01-05 16:49:23 | [diff] [blame] | 311 | |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 312 | ## Tips, tricks, and troubleshooting |
tfarina | a68eb90 | 2016-04-12 19:43:05 | [diff] [blame] | 313 | |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 314 | ### Rebuilding libchrome.so for a particular release |
tfarina | a68eb90 | 2016-04-12 19:43:05 | [diff] [blame] | 315 | |
yfriedman | 9b4327b | 2016-05-04 16:36:24 | [diff] [blame] | 316 | These instructions are only necessary for Chrome 51 and earlier. |
| 317 | |
tfarina | a68eb90 | 2016-04-12 19:43:05 | [diff] [blame] | 318 | In the case where you want to modify the native code for an existing |
| 319 | release of Chrome for Android (v25+) you can do the following steps. |
| 320 | Note that in order to get your changes into the official release, you'll |
| 321 | need to send your change for a codereview using the regular process for |
| 322 | committing code to chromium. |
| 323 | |
| 324 | 1. Open Chrome on your Android device and visit chrome://version |
| 325 | 2. Copy down the id listed next to "Build ID:" |
| 326 | 3. Go to |
| 327 | [http://storage.googleapis.com/chrome-browser-components/BUILD\_ID\_FROM\_STEP\_2/index.html](http://storage.googleapis.com/chrome-browser-components/BUILD_ID_FROM_STEP_2/index.html) |
| 328 | 4. Download the listed files and follow the steps in the README. |