build chromium for android

来源:互联网 发布:淘宝网书籍 编辑:程序博客网 时间:2024/06/04 20:21

Get the code

下载安装depot_tools
clone depot_tools, 并添加到PATH里面去:

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

下载代码

    $ mkdir ~/chromium && cd ~/chromium    ~/chromium$ fetch --nohooks android    ~/chromium/src$ gclient sync

Configure your build

chromium Android版本支持GN和GYP编译配置, 推荐使用GN, 最新版本GYP编译出错.

    ~/chromium$ gclient runhooks    cd src    ~/chromium/src$ gn args out/Default

出现vi编辑文件的界面, 添上如下内容:

    target_os = "android"    target_cpu = "arm"  # (default)    is_debug = true  # (default)    # Other args you may want to set:    is_component_build = true    is_clang = true    symbol_level = 1  # Faster build with fewer symbols. -g1 rather than -g2    enable_incremental_javac = true  # Much faster; experimental    

安装依赖库

配置使用OpenJDK 1.7

    ~/chromium/src$ build/install-build-deps-android.sh

编译运行

编译整个浏览器

    ~/chromium/src$ . build/android/envsetup.sh    ~/chromium/src$ ninja -C out/Default chrome_public_apk    ~/chromium/src$ build/android/adb_install_apk.py out/Default/apks/ChromePublic.apk

编译webview.apk

    ~/chromium/src$ ninja -C out/Release android_webview_apk
0 0