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

Side by Side Diff: docs/old_android_build_instructions.md

Issue 2544963002: Remove links to old 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
OLDNEW
(Empty)
1 # Android Build Instructions
2
3 **Generally, this page is obsolete and you should look at
4 [the new page instead](android_build_instructions.md).**
5
6 [TOC]
7
8 ## Prerequisites
9
10 A Linux build machine capable of building [Chrome for
11 Linux](https://chromium.googlesource.com/chromium/src/+/master/docs/linux_build_ instructions_prerequisites.md).
12 Other (Mac/Windows) platforms are not supported for Android.
13
14 ## Getting the code
15
16 First, check out and install the [depot\_tools
17 package](https://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_t ools/docs/html/depot_tools_tutorial.html#_setting_up).
18
19 Then, if you have no existing checkout, create your source directory and
20 get the code:
21
22 ```shell
23 mkdir ~/chromium && cd ~/chromium
24 fetch --nohooks android # This will take 30 minutes on a fast connection
25 ```
26
27 If you have an existing Linux checkout, you can add Android support by
28 appending `target_os = ['android']` to your .gclient file (in the
29 directory above src):
30
31 ```shell
32 cat > .gclient <<EOF
33 solutions = [ ...existing stuff in here... ]
34 target_os = [ 'android' ] # Add this to get Android stuff checked out.
35 EOF
36 ```
37
38 Then run gclient sync to get the Android stuff checked out:
39
40 ```shell
41 gclient sync
42 ```
43
44 ## (Optional) Check out LKGR
45
46 If you want a single build of Chromium in a known good state, sync to
47 the LKGR ("last known good revision"). You can find it
48 [here](http://chromium-status.appspot.com/lkgr), and the last 100
49 [here](http://chromium-status.appspot.com/revisions). Run:
50
51 ```shell
52 gclient sync --nohooks -r <lkgr-sha1>
53 ```
54
55 This is not needed for a typical developer workflow; only for one-time
56 builds of Chromium.
57
58 ## Configure GN
59
60 Create a build directory and set the build flags with:
61
62 ```shell
63 gn args out/Default
64 ```
65
66 You can replace out/Default with another name you choose inside the out
67 directory.
68
69 Also be aware that some scripts (e.g. tombstones.py, adb_gdb.py)
70 require you to set `CHROMIUM_OUTPUT_DIR=out/Default`.
71
72 This command will bring up your editor with the GN build args. In this
73 file add:
74
75 ```
76 target_os = "android"
77 target_cpu = "arm" # (default)
78 is_debug = true # (default)
79
80 # Other args you may want to set:
81 is_component_build = true
82 is_clang = true
83 symbol_level = 1 # Faster build with fewer symbols. -g1 rather than -g2
84 enable_incremental_javac = true # Much faster; experimental
85 ```
86
87 You can also specify `target_cpu` values of "x86" and "mipsel". Re-run
88 gn args on that directory to edit the flags in the future. See the [GN
89 build
90 configuration](https://www.chromium.org/developers/gn-build-configuration)
91 page for other flags you may want to set.
92
93 ### Install build dependencies
94
95 Update the system packages required to build by running:
96
97 ```shell
98 ./build/install-build-deps-android.sh
99 ```
100
101 Make also sure that OpenJDK 1.7 is selected as default:
102
103 `sudo update-alternatives --config javac`
104 `sudo update-alternatives --config java`
105 `sudo update-alternatives --config javaws`
106 `sudo update-alternatives --config javap`
107 `sudo update-alternatives --config jar`
108 `sudo update-alternatives --config jarsigner`
109
110 ### Synchronize sub-directories.
111
112 ```shell
113 gclient sync
114 ```
115
116 ## Build and install the APKs
117
118 If the `adb_install_apk.py` script below fails, make sure aapt is in
119 your PATH. If not, add aapt's path to your PATH environment variable (it
120 should be
121 `/path/to/src/third_party/android_tools/sdk/build-tools/{latest_version}/`).
122
123 Prepare the environment:
124
125 ```shell
126 . build/android/envsetup.sh
127 ```
128
129 ### Plug in your Android device
130
131 Make sure your Android device is plugged in via USB, and USB Debugging
132 is enabled.
133
134 To enable USB Debugging:
135
136 * Navigate to Settings \> About Phone \> Build number
137 * Click 'Build number' 7 times
138 * Now navigate back to Settings \> Developer Options
139 * Enable 'USB Debugging' and follow the prompts
140
141 You may also be prompted to allow access to your PC once your device is
142 plugged in.
143
144 You can check if the device is connected by running:
145
146 ```shell
147 third_party/android_tools/sdk/platform-tools/adb devices
148 ```
149
150 Which prints a list of connected devices. If not connected, try
151 unplugging and reattaching your device.
152
153 ### Build the full browser
154
155 ```shell
156 ninja -C out/Release chrome_public_apk
157 ```
158
159 And deploy it to your Android device:
160
161 ```shell
162 CHROMIUM_OUTPUT_DIR=$gndir build/android/adb_install_apk.py $gndir/apks/ChromePu blic.apk # for gn.
163 ```
164
165 The app will appear on the device as "Chromium".
166
167 ### Build Content shell
168
169 Wraps the content module (but not the /chrome embedder). See
170 [http://www.chromium.org/developers/content-module](http://www.chromium.org/deve lopers/content-module)
171 for details on the content module and content shell.
172
173 ```shell
174 ninja -C out/Release content_shell_apk
175 build/android/adb_install_apk.py out/Release/apks/ContentShell.apk
176 ```
177
178 this will build and install an Android apk under
179 `out/Release/apks/ContentShell.apk`. (Where `Release` is the name of your build
180 directory.)
181
182 If you use custom out dir instead of standard out/ dir, use
183 CHROMIUM_OUT_DIR env.
184
185 ```shell
186 export CHROMIUM_OUT_DIR=out_android
187 ```
188
189 ### Build WebView shell
190
191 [Android WebView](http://developer.android.com/reference/android/webkit/WebView. html)
192 is a system framework component. Since Android KitKat, it is implemented using
193 Chromium code (based off the [content module](http://dev.chromium.org/developers /content-module)).
194 It is possible to test modifications to WebView using a simple test shell. The
195 WebView shell is a view with a URL bar at the top (see [code](https://code.googl e.com/p/chromium/codesearch#chromium/src/android_webview/test/shell/src/org/chro mium/android_webview/test/AwTestContainerView.java))
196 and is **independent** of the WebView **implementation in the Android system** (
197 the WebView shell is essentially a standalone unbundled app).
198 As drawback, the shell runs in non-production rendering mode only.
199
200 ```shell
201 ninja -C out/Release android_webview_apk
202 build/android/adb_install_apk.py out/Release/apks/AndroidWebView.apk
203 ```
204
205 If, instead, you want to build the complete Android WebView framework component and test the effect of your chromium changes in other Android app using the WebV iew, you should follow the [Android AOSP + chromium WebView instructions](http:/ /www.chromium.org/developers/how-tos/build-instructions-android-webview)
206
207 ### Running
208
209 Set [command line flags](https://www.chromium.org/developers/how-tos/run-chromiu m-with-flags) if necessary.
210
211 For Content shell:
212
213 ```shell
214 build/android/adb_run_content_shell http://example.com
215 ```
216
217 For Chrome public:
218
219 ```shell
220 build/android/adb_run_chrome_public http://example.com
221 ```
222
223 For Android WebView shell:
224
225 ```shell
226 build/android/adb_run_android_webview_shell http://example.com
227 ```
228
229 ### Logging and debugging
230
231 Logging is often the easiest way to understand code flow. In C++ you can print
232 log statements using the LOG macro or printf(). In Java, you can print log
233 statements using [android.util.Log](http://developer.android.com/reference/andro id/util/Log.html):
234
235 `Log.d("sometag", "Reticulating splines progress = " + progress);`
236
237 You can see these log statements using adb logcat:
238
239 ```shell
240 adb logcat...01-14 11:08:53.373 22693 23070 D sometag: Reticulating splines prog ress = 0.99
241 ```
242
243 You can debug Java or C++ code. To debug C++ code, use one of the
244 following commands:
245
246 ```shell
247 build/android/adb_gdb_content_shell
248 build/android/adb_gdb_chrome_public
249 build/android/adb_gdb_android_webview_shell http://example.com
250 ```
251
252 See [Debugging Chromium on Android](https://www.chromium.org/developers/how-tos/ debugging-on-android)
253 for more on debugging, including how to debug Java code.
254
255 ### Testing
256
257 For information on running tests, see [android\_test\_instructions.md](https://c hromium.googlesource.com/chromium/src/+/master/docs/android_test_instructions.md ).
258
259 ### Faster Edit/Deploy (GN only)
260
261 GN's "incremental install" uses reflection and side-loading to speed up the edit
262 & deploy cycle (normally < 10 seconds).
263
264 * Make sure to set` is_component_build = true `in your GN args
265 * All apk targets have \*`_incremental` targets defined (e.g.
266 `chrome_public_apk_incremental`)
267
268 Here's an example:
269
270 ```shell
271 ninja -C out/Default chrome_public_apk_incremental
272 out/Default/bin/install_chrome_public_apk_incremental -v
273 ```
274
275 For gunit tests (note that run_*_incremental automatically add
276 --fast-local-dev when calling test\_runner.py):
277
278 ```shell
279 ninja -C out/Default base_unittests_incremental
280 out/Default/bin/run_base_unittests_incremental
281 ```
282
283 For instrumentation tests:
284
285 ```shell
286 ninja -C out/Default chrome_public_test_apk_incremental
287 out/Default/bin/run_chrome_public_test_apk_incremental
288 ```
289
290 To uninstall:
291
292 ```shell
293 out/Default/bin/install_chrome_public_apk_incremental -v --uninstall
294 ```
295
296 ### Miscellaneous
297
298 #### Rebuilding libchrome.so for a particular release
299
300 These instructions are only necessary for Chrome 51 and earlier.
301
302 In the case where you want to modify the native code for an existing
303 release of Chrome for Android (v25+) you can do the following steps.
304 Note that in order to get your changes into the official release, you'll
305 need to send your change for a codereview using the regular process for
306 committing code to chromium.
307
308 1. Open Chrome on your Android device and visit chrome://version
309 2. Copy down the id listed next to "Build ID:"
310 3. Go to
311 [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)
312 4. Download the listed files and follow the steps in the README.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698