chromium编译android,Ubuntu下编译Chromium for Android

本文详细介绍了Chromium编译Android的过程,包括下载源码、配置环境、设置编译目标、运行目标等步骤,还分享了编译过程中遇到的问题及解决办法,如gclient sync --nohooks下载时间长、gclient runhooks出错、ninja命令找不到等。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

转自:http://blog.youkuaiyun.com/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 "[email protected]"

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.youkuaiyun.com/yajun0601/article/details/8583289

编译

https://code.google.com/p/chromium/wiki/AndroidBuildInstructions

原文:http://www.cnblogs.com/x_wukong/p/5013271.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值