For Developers‎ > ‎How-Tos‎ > ‎

Build Instructions (Android WebView)


These are instructions for building the Android WebView. These instructions are necessary if you wish to run the WebView code as an Android system component (which is useful when working on performance or application compatibility). To run tests and for certain development tasks it is sufficient to use the standalone test shell as described here.


A machine capable of building AndroidBeing able to checkout and build Chrome for Android.

Building with ninja

For googlers, see internal instructions.

One-time Android OS set up

This workflow currently requires a device with AOSP builds of Android Lollipop 5.0.0 release, with root access. Follow instructions at to build and flash the correct AOSP version to your device. Here's the rough flow of building AOSP for Nexus 5.
# Checkout code
repo init -u -b android-5.0.0_r19
repo sync -j<number>
# Obtain and extract binary drivers at for your device

# Building
source build/
lunch aosp_<device>-userdebug # hammerhead for nexus 5, mako for nexus 4, flo for newer nexus 7
make -j<number>

# Flash to device
adb reboot bootloader
fastboot -w flashall


Follow the instructions here for getting the source and building chromium for android.
gn gen out/Release --args='target_os="android"'  # For 64-bit devices, use: --args='target_os="android" target_cpu="arm64"'
ninja -C out/Release system_webview_apk

Installing onto the device

There is a one time device set up to remove the existing webview. This is needed because it is not possible to install over the existing apk due to mismatched signing key.
# Uninstall any webview updates
adb uninstall  # May fail
adb uninstall  # May fail
# On M and up:
adb disable-verity; adb reboot

# Remove webview from system partition
adb root
adb remount
adb shell stop
adb shell rm -rf /system/app/webview /system/app/WebViewGoogle /system/app/WebViewStub
adb shell start
Install the built apk.
adb install -r -d out/Release/apks/SystemWebView.apk

Test shell: system_webview_shell_apk

  • This is a simple shell app that uses the system webview.
  • The activity is called 'WebView Browser'
  • Build and install:
  • ninja -C out/Default system_webview_shell_apk
    adb install -r out/Default/apks/SystemWebViewShell.apk
  • Open pages (http:// prefix is required, otherwise you'll get an empty page):
    out/Release/bin/system_webview_apk launch

Test shell: webview_instrumentation_apk

  • This embeds a copy of the webview in the apk rather than using the system webview.
  • The activity is called 'Android WebView'
  • It is essentially a TestContainerView with a URL bar at the top and runs in hardware mode.
  • Build and install:
    ninja -C out/Default webview_instrumentation_apk
    adb install -r out/Default/apks/WebViewInstrumentation.apk
  • Open pages (http:// prefix is required, otherwise you'll get an empty page):
    out/Release/bin/webview_instrumentation_apk launch