Building Chromium Content Shell for Android is a fundamental step for developers who want to study Browser Engine operations or customize a Web View for their own use. This article summarizes the build process from setting up the machine to obtaining the APK file.

What is Content Shell?

Content Shell is a “minimal browser” used by the Chromium team to test the Content Module (the part responsible for rendering the web). It lacks full browser features (like Bookmarks, Extensions, or Sync), making it lightweight and ideal for testing or as a starting point for code study.

+-----------------------------------------------------+
|                  Chromium Project                   |
+-----------------------------------------------------+
|                                                     |
|  [ Chrome Browser ]         [ Content Shell ]       |
|  - Full UI                  - Minimal UI            |
|  - Extensions               - For Testing           |
|  - Sync                     - No Bloat              |
|         |                          |                |
|         +-----------+--------------+                |
|                     |                               |
|                     v                               |
|          +-----------------------+                  |
|          |     Content Module    |                  |
|          | (Core Browser Logic)  |                  |
|          +----------+------------+                  |
|                     |                               |
|                     v                               |
|          +-----------------------+                  |
|          |      Blink / V8       |                  |
|          |   (Rendering Engine)  |                  |
|          +-----------------------+                  |
+-----------------------------------------------------+

Step 1: System Requirements

Building Chromium requires significant resources. It is recommended to have:

  • OS: Linux 64-bit (Ubuntu 22.04 LTS or newer is highly recommended)
  • RAM: At least 16GB (32GB+ recommended)
  • Disk Space: At least 100GB for Source code and Output files (SSD recommended)

Step 2: Install depot_tools

Chromium uses a specific set of tools called depot_tools to manage code.

git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
export PATH="$PATH:/path/to/depot_tools"

Don’t forget to add the export PATH line to your .bashrc or .zshrc to make it permanent.

Step 3: Get Source Code

Create a working directory and fetch the code for Android:

mkdir chromium && cd chromium
fetch --nohooks android

This step will take a long time (downloading tens of GBs of data) and requires a stable internet connection.

After the download is complete, sync the code:

cd src
gclient sync

Step 4: Install Dependencies

Chromium provides a script to help install necessary dependencies for Ubuntu:

./build/install-build-deps-android.sh

Step 5: Configure Build (GN Args)

We need to define that we are building for Android and specify the architecture (e.g., ARM64).

  1. Create a build folder:

    gn gen out/AndroidContentShell
    
  2. Set Arguments:

    gn args out/AndroidContentShell
    

    An editor will pop up. Add the following config:

    target_os = "android"
    target_cpu = "arm64"  # or "x64" if running on an Emulator
    is_debug = false       # true if you need to debug, but files will be larger and slower
    is_component_build = true # helps build faster during development
    

Step 6: Build

Use the autoninja command (a wrapper for ninja tuned for Chromium) to start the build. The target is content_shell_apk.

autoninja -C out/AndroidContentShell content_shell_apk

This step will take the longest (potentially hours, depending on CPU power).

Step 7: Install

Once the build is complete, you will find the APK file at out/AndroidContentShell/apks/ContentShell.apk.

Connect your Android phone via USB (with Developer Mode enabled) and run:

adb install out/AndroidContentShell/apks/ContentShell.apk

Or use the chromium script:

./build/android/adb_install_apk.py out/AndroidContentShell/apks/ContentShell.apk

Now you have the Content Shell app (the blue icon) on your device, ready to test opening websites with the engine you built yourself!


Note: The Chromium build process changes constantly. It is recommended to always check the Official Documentation as well.