For Developers‎ > ‎How-Tos‎ > ‎

Build Instructions (Android WebView)

Summary

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.

Prerequisites

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 https://source.android.com/source/building.html 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 https://android.googlesource.com/platform/manifest -b android-5.0.0_r7
repo sync -j<number>

# Building
source build/envsetup.sh
lunch aosp_hammerhead-userdebug
make -j<number>

# Flash to device
adb reboot bootloader
fastboot -w flashall

Building

Follow the instructions here for getting the source and building chromium for android.
build/gyp_chromium -DOS=android
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
Comments