For Developers‎ > ‎How-Tos‎ > ‎

Build Instructions (Android WebView)

Note: If you're building WebView for the first time, we strongly recommend the Quick Start guide

For googlers, skip this page and see internal instructions (or, use the quick start guide above).


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.

Device/emulator setup

Please read the documentation committed in chromium markdown:


Being able to checkout and build Chrome for Android.

Building with ninja


Follow the instructions here for getting the source and building chromium for android.
gn gen out/Default --args='target_os="android"'  # For 64-bit devices, use: --args='target_os="android" target_cpu="arm64"'
autoninja -C out/Default 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.
# With a script (recommended)

# Manual steps (not recommended)
# 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
# The actual paths will vary based on Android release, this is a "best guess":
adb shell rm -rf /system/app/webview /system/app/WebViewGoogle /system/app/WebViewStub \
                 /system/product_services/app/webview /system/product_services/app/WebViewGoogle \
                 /system/product_services/app/WebViewStub /system/product_services/app/TrichromeWebView
adb shell start
Install the built apk.
out/Default/bin/system_webview_apk install

# Alternatively, you can use bare adb commands:
adb install -r -d out/Default/apks/SystemWebView.apk

Using an Emulator (x86)

  • See Using an Android Emulator for a setup guide
  • Configure GN args with target_cpu = "x86"
  • Hide system image webview (tested on api 21):

adb shell stop
adb shell mkdir /data/local/tmp/empty
adb shell mount -o bind /data/local/tmp/empty /system/app/webview
adb shell start
  • Install as above.

Test shell: system_webview_shell_apk

Please read the documentation committed in chromium markdown:

Test shell: webview_instrumentation_apk

  • Simpler workflow: this embeds a copy of the AwContents (webview's internal core) in the apk rather than using the system webview, so you don't need to use a userdebug build.
  • Limitation: This is not real webview, so testability may be limited.
  • It is essentially a TestContainerView with a URL bar at the top and runs in hardware mode.
  • Build and install:
    autoninja -C out/Default webview_instrumentation_apk
    out/Default/bin/webview_instrumentation_apk install
  • Open pages (http:// prefix is required, otherwise you'll get an empty page):
    out/Default/bin/webview_instrumentation_apk launch