Ubuntu下编译Chromium for Android

转自:http://blog.csdn.net/fsz521/article/details/18036835

 

下源码
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git (https慢可以换成http)
export PATH="$PATH":`pwd`/depot_tools(也可添加到环境变量文件中“PATH=$PATH:~/Chromium/depot_tools“)
git config --global user.name "My Name"
git config --global user.email "my@email"
git config --global core.autocrlf false
git config --global core.filemode false
gclient config https://chromium.googlesource.com/chromium/src.git --git-deps
打开.gclient文件,设置不下载无用代码:
"custom_deps"字段中添加:
"custom_deps": {
"src/content/test/data/layout_tests/LayoutTests": None,
"src/chrome/tools/test/reference_build/chrome_win": None,
"src/chrome_frame/tools/test/reference_build/chrome_win":None,
"src/chrome/tools/test/reference_build/chrome_linux":None,
"src/chrome/tools/test/reference_build/chrome_mac": None,
"src/third_party/hunspell_dictionaries": None,
},
最后一行添加:
target_os= ['android']

gclient sync --nohooks
. src/build/android/envsetup.sh 
gclient runhooks


配环境

cd src
sudo build/install-build-deps-android.sh --no-chromeos-fonts
安装oracle的jdk6


编译目标
export GYP_GENERATORS=ninja
. build/android/envsetup.sh
android_gyp
ninja -C out/Debug  android_webview_apk


运行目标
out/Debug/apk下有编译出的apk文件,安装到android手机或模拟器即可。


碰到的疑惑与问题
gclient sync--nohooks:下载源码,执行时间长,耐心等待
gclientrunhooks:下载一些东西过程中提示出错,保险起见,根据官方意见:
------------------
Bootstrap notes for Ubuntu
The first time you do a fetch, you maynot have all the build dependencies installed that are required, andgclient runhooks will fail. You can resolve this after fetching byrunning the install-build-deps.sh script:
cd /path/to/chromium/src
./build/install-build-deps.sh
Then run gclient runhooks again tofinish the fetch process.
---------------------
先执行这里命令./build/install-build-deps.sh,但会报错:ChromeOS fonts下载不下来。
根据出错提示,执行命令:
./build/install-build-deps.sh--no-chromeos-fonts,
执行成功。
执行ninja命令时提示找不到ninja:
执行命令exportPATH="$PATH":`pwd`/depot_tools(该环境变量仅对当前命令窗口有效,可添加到系统环境变量中)


gclient sync --nohooks
. build/android/envsetup.sh
gclient runhooks
sudobuild/install-build-deps-android.sh --no-chromeos-fonts
sudo build/install-build-deps.sh--no-chromeos-fonts
. build/android/envsetup.sh
android_gyp
ninja -C out/Release content_shell_apk
chromium_testshell
android_webview_apk(运行:
adb_run_android_webview_shellhttp://www.google.com)
mkdir Chromium && cd Chromium
git clonehttp://chromium.googlesource.com/chromium/tools/depot_tools.git
export PATH="$PATH":`pwd`/depot_tools
exportPATH="$PATH":`pwd`/depot_toolsgclient confighttp://chromium.googlesource.com/chromium/src.git--git-deps"src/third_party/WebKit/LayoutTests":None,"src/content/test/data/layout_tests/LayoutTests":None,"src/content/test/data/layout_tests/LayoutTests":None,"src/chrome/tools/test/reference_build/chrome_win":None,"src/chrome_frame/tools/test/reference_build/chrome_win":None,"src/chrome/tools/test/reference_build/chrome_linux":None,"src/chrome/tools/test/reference_build/chrome_mac":None,"src/third_party/hunspell_dictionaries":None,target_os = ['android']
参考:
下载源码
http://dev.chromium.org/developers/how-tos/get-the-code
http://blog.csdn.net/yajun0601/article/details/8583289
编译
https://code.google.com/p/chromium/wiki/AndroidBuildInstructions

posted @ 2015-12-02 15:55  明明是悟空  阅读(3149)  评论(0编辑  收藏  举报