Commit e5d411c8 authored by Nate Fischer's avatar Nate Fischer Committed by Commit Bot

AW docs: device/emulator setup instructions

No change to code, only docs.

This adds device/emulator setup instructions. This recommends the
emulator, as it's publicly available and easy to setup. For physical
devices, this points to an Android site hosting publicly available
images (and directs Googlers to internal instructions).

This also documents how to build AOSP, but recommends against doing so.
The intent is to update
https://www.chromium.org/developers/how-tos/build-instructions-android-webview
to point to this page, so I've included this for completeness.

R=ctzsm@chromium.org

Bug: 918221
Test: tools/md_browser/md_browser.py
Test: Upload to gerrit > open file > click "gitiles"
Change-Id: I668171e9ed76a3af36429fc9218e4b236b4dd085
Reviewed-on: https://chromium-review.googlesource.com/c/1490407Reviewed-by: default avatarShimi Zhang <ctzsm@chromium.org>
Commit-Queue: Nate Fischer <ntfschr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#636210}
parent a23e328c
# Device Setup for WebView development
[TOC]
As WebView is an Android system component (rather than just an app), WebView
imposes additional requirements on the developer workflow. In particular,
WebView requires a physical device or emulator with a `userdebug` or `eng`
Android image.
To build WebView, or [run WebView's automated tests](./test-instructions.md),
you'll need to set up either an emulator or a physical device.
## Emulator (easy way)
*** promo
Unless you have a hardware-specific bug, or need to use a pre-release Android
version, a physical device is usually unnecessary. An `x86` emulator should be
easier to setup.
***
You can generally follow chromium's [Android
emulator](/docs/android_emulator.md) instructions. You should choose a **Google
APIs** image. The AOSP-based image will also work, but imposes additional
developer hurdles.
## Physical device
*** promo
If you're a Googler, please see internal instructions
[here](http://go/clank-webview/building-webview/device-setup).
***
External developers can obtain Nexus/Pixel images
[here](https://source.android.com/setup/build/running.html).
## Building AOSP yourself (hard way)
*** note
This takes significantly longer than the two previous methods, so please
strongly consider one of the above first.
***
**Prerequisite:** a machine capable of [building
Android](http://source.android.com/source/building.html).
Clone an AOSP checkout, picking a branch supported for your device (you'll need
a branch above 5.0.0) from the [list of
branches](https://source.android.com/setup/start/build-numbers.html#source-code-tags-and-builds):
```shell
mkdir aosp/ && cd aosp/ && \
repo init -u https://android.googlesource.com/platform/manifest -b android-9.0.0_r33 && \
repo sync -c -j<number>
```
You can obtain binary drivers for Nexus/Pixel devices
[here](https://developers.google.com/android/drivers). Drivers should match your
device and branch. Extract and run the shell script:
```shell
# Change the filenames to match your device/branch (this uses "crosshatch" as an
# example)
tar -xvzf /path/to/qcom-crosshatch-pd1a.180720.030-bf86f269.tgz
./extract-qcom-crosshatch.sh # Extracts to the vendor/ folder
```
You can build AOSP and flash your device with:
```shell
source build/envsetup.sh
device="crosshatch" # Change this depending on your device hardware
lunch aosp_${device}-userdebug
make -j<number>
# Flash to device
adb reboot bootloader
fastboot -w flashall
```
For more information, please defer to [official
instructions](https://source.android.com/setup/build/downloading).
## Why won't a user image work?
`user` images have all of Android's security features turned on (and they can't
be disabled). In particular, you won't be able to install a locally built
WebView:
* Most `user` images are `release-keys` signed, which means local WebView builds
can't install over the preinstalled standalone WebView. This blocks
development on L-M, since this is the only WebView provider.
* On N+, although you _can install_ a locally compiled
`monochrome_{public_}apk`, this is not a valid WebView provider. Unlike on
`userdebug`/`eng` images, the WebView update service performs additional
signature checks on `user` images, only loading code that has been signed by
one of the expected signatures--as above, these keys are not available for
local builds.
Both of the above are important security features: these protect users from
running malware in the context of WebView (which runs inside the context of
apps).
# WebView docs (go/webview-docs) # WebView docs (go/webview-docs)
* [Home][home] * [Home][home]
* [Device Setup](/android_webview/docs/device-setup.md)
* [Test instructions](/android_webview/docs/test-instructions.md) * [Test instructions](/android_webview/docs/test-instructions.md)
* [Commandline flags](/android_webview/docs/commandline-flags.md) * [Commandline flags](/android_webview/docs/commandline-flags.md)
* [Net debugging](/android_webview/docs/net-debugging.md) * [Net debugging](/android_webview/docs/net-debugging.md)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment