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_r7
repo sync -j<number>

# Building
source build/
lunch aosp_hammerhead-userdebug
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. The only difference is gyp defines and the build target.
build/gyp_chromium -DOS=android -Dandroid_webview_telemetry_build=1
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.
adb root
adb remount
adb shell stop
adb shell rm -rf /system/app/webview /system/app/WebViewGoogle
adb shell start
Install the built apk.
adb install -r -d out/Release/apks/SystemWebView.apk

Common problems

This section describes common scenarios where the android_aosp bot (which is supposed to keep this workflow working) might break:

New dependency

    You've added an (in)direct dependency from the android_webview/ to a third_party library. You can hit this by adding deps to something the android_webview depends on (like content/ or net/ or base/, etc..).
solution: you need to add the new dep to android_webview/buildbot/
symptom: The bot is failing because it can't gyp or compile some source code that should be there (and is normally synced via DEPS).

android_webview API changes

    You modified the android_webview/ "public" Java API. In some rare cases we export content layer types as part of our public API so it's possible to hit this without touching code in the android_webview folder.Also some content/ Java resources and the resource maps count as the "public" API so touching those can break the bot.
symptom: the bot is failing to compile Java code from android-src/frameworks/webview complaining about missing types/fields/methods/etc..
solution: you need to update the code in AOSP to match. See the "Contributing Code" section above.