編譯 chromium for android

此文版權屬於作者所有,任何人、媒體或者網站轉載、借用都必須徵得作者本人同意!

開發環境:ubuntu 13.10


2017


現在要編譯 40.0.2214.95 的版本不容易了,以下幾點關心一下:

1、java 要 7

2、leveldatabase 無法同步,把 DEPS 和 .DEPS.git 裏的:

3f77584eb3f9754bbb7079070873ece3f30a1e6b 改爲 803d69203a62faf50f1b77897310a3a1fcae712b

3、export DEPOT_TOOLS_UPDATE=0

4、gclient sync --with_branch_heads

然後就靠運氣了。


2015

  1. Get the Code (http://dev.chromium.org/developers/how-tos/get-the-code)

    fetch --nohooks android
    #如果這裏發生 svn 的錯誤,嘗試用命令
    #fetch --nohooks android --nosvn=True
    cd src
    git checkout master;
    cd ..
    echo "{ 'GYP_DEFINES': 'OS=android', }" > chromium.gyp_env
    gclient runhooks

    上面步驟是下載當前最新的源碼,如果要求指定版本的源碼,參考:working with release branches
    關鍵是 2 點,切換分支和同步,比如我想切換到版本 40.0.2214.109 的源碼:
      git checkout 40.0.2214.109
      gclient sync --with_branch_heads

    上面
       echo "{ 'GYP_DEFINES': 'OS=android', }" > chromium.gyp_env
    會使後面生成的 c++ 動態庫爲一個獨立的包,如果需要把各個模塊的 c++ 庫都生成單獨的動態庫,需要這樣:
       echo "{ 'GYP_DEFINES': 'OS=android component=shared_library', }" > chromium.gyp_env
    具體參考 gyp environment variables

  2. install deps for android

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

  3. Build(https://code.google.com/p/chromium/wiki/AndroidBuildInstructions)

    ninja -C out/Release chrome_shell_apk
    #如果是webview工程,這樣來
    #ninja -C out/Release android_webview_apk

  4. Install apk to android device

      build/android/adb_install_apk.py --apk ChromeShell.apk --release
    or
      adb install out/Release/apks/ChromeShell.apk

    #webview 的工程輸出是
    #build/android/adb_install_apk.py --apk AndroidWebView.apk --apk_package org.chromium.android_webview.shell --release

  5. 更新代碼

    gclient sync --nohooks

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章