编译android平台上的webrtc-chromium

来源:互联网 发布:精业本草中医堂淘宝店 编辑:程序博客网 时间:2024/05/17 04:14

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


AndroidBuildInstructions  
Build instructions for Chromium for Android
Updated Today (16 hours ago) by su...@chromium.org

Prerequisites

  • A Linux build machine capable of building Chrome for Linux. At this time building on Mac for Android is not supported.

Getting the code

You can check out the source code with SVN, or better check out the source code with Git. In each case, follow the Android-specific instructions.

Once you have a complete checkout, make sure your .gclient file contains Android as a target OS (at the very end, outside all brackets):

target_os = ['android']

You should avoid running gclient hooks when syncing for the first time, as the setup for these tools is not complete untilbuild/android/envsetup.sh has been run.

gclient sync --nohooks. build/android/envsetup.shgclient runhooks

If you are testing a feature requiring API keys, install API keys as in the Linux instructions.

Install prerequisites

The Android SDK/NDK is checked into the chromium tree in $SRC/third_party/android_tools and does not need to be installed. The following script installs other tools needed by the Chrome on Android build.

cd $SRC/buildsudo ./install-build-deps-android.sh

In addition, you must manually install the Oracle Java JDK and configure it to be the default Java compiler:

  • Visit http://www.oracle.com/technetwork/java/javase/downloads/index.html
  • Click on “Java SE 6 - JDK”
  • Accept the license agreement
  • Download jdk-6u38-linux-x64.bin

Here is how to configure it to be the default on Ubuntu:

cd /usr/lib/jvm && sudo /bin/sh ~/Downloads/jdk-6u38-linux-x64.bin -noregister

Note: You might get /bin/sh: jdk-6u43-linux-x64.bin: Permission denied error. This happens because root does not permissions to read the ~/Downloads folder.

Option 1: Temporarily change the permissions of ~/Downloads folder for root to have read permission.

chmod 755 ~/Downloads/

Don’t forget to change it back once you are done!

Option 2: Copy the downloaded file to /usr/lib/jvm and do

sudo /bin/sh jdk-6u38-linux-x64.bin -noregister

In either case, then set it as default.

sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.6.0_38/bin/javac 50000sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.6.0_38/bin/java 50000sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk1.6.0_38/bin/javaws 50000sudo update-alternatives --install /usr/bin/javap javap /usr/lib/jvm/jdk1.6.0_38/bin/javap 50000sudo update-alternatives --config javacsudo update-alternatives --config javasudo update-alternatives --config javawssudo update-alternatives --config javap

Also make sure /usr/bin/java is first in your $PATH. i.e.

which java

should return /usr/bin/java.

Compile

  • Make sure you're not using clang: unset CC; unset CXX
  • Make sure you're not using the component build (modify your GYP_DEFINES or.gyp/include.gypi as appropriate to remove component=shared_library)

To build the ARM Android content shell:

. build/android/envsetup.shandroid_gypninja -C out/Release -j10 content_shell_apk

If you wish to compile for x86 Android, you need to pass the --target-arch flag. For example:

. build/android/envsetup.sh --target-arch=x86android_gypninja -C out/Release -j10 content_shell_apk

Enable USB debugging on your Android device

On Jellybean, developer options are hidden by default. To unhide them, go to "About phone" and tap 10 times on "Build number". Then the "Developer options" menu will be available. Check "USB debugging" to allow installing the APKs via ADB.5000

If you are running on an emulator, note that Chrome for Android requires hardware acceleration. Make sure that you have enabledGPU emulation in Hardware settings of the AVD being used.

Installing Content Shell

See http://www.chromium.org/developers/content-module for details on the content module and content shell.

To install, run, or debug it, we have shell scripts to assist:

build/android/adb_install_apk.py --apk ContentShell.apk --releasebuild/android/adb_run_content_shellbuild/android/adb_gdb_content_shell

To pass command-line flags to the content-shell: build/android/adb_content_shell_command_line <arguments>

If the adb_install_apk.py script fails, make sure aapt is in your PATH (you can check that"which aapt" returns a path). If not, add aapt's path to your PATH environment variable (it should be/path/to/src/third_party/android_tools/sdk/platform-tools/)

Chromium TestShell (in development)

Based on the chrome layer, includes more stuff from Chromium.

To install, run, or debug it, we have shell scripts to assist:

ninja -C out/Release -j10 chromium_testshellbuild/android/adb_install_apk.py --apk ChromiumTestShell.apk --releasebuild/android/adb_run_chromium_testshellbuild/android/adb_gdb_chromium_testshell

To pass command-line flags to the testshell: build/android/adb_chromium_testshell_command_line <arguments>

Running Unit Tests

ninja -C out/Release -j10 android_builder_tests# Run with --help to get arguments.# Most useful: use -e to run tests in an emulator; else it assumes you have a phone plugged in.build/android/run_tests.py# Running a particular testbuild/android/run_tests.py -s base_unittests -f PathUtilTest.BasicTest

Running Instrumentation Tests

ninja -C out/Release -j10 content_shell_apk android_builder_testsbuild/android/adb_install_apk.py --apk ContentShell.apk --release# Run with --help to get arguments.build/android/run_instrumentation_tests.py -I --test-apk ContentShellTest -vvv

Running content browser tests

ninja -C out/Release -j10 content_browsertests_apkbuild/android/run_browser_tests.py --verbose --num_retries=1# Running a particular testbuild/android/run_browser_tests.py --verbose --num_retries=1 -f SessionHistoryTest.JavascriptHistory

Rebuilding libchromeview.so for a particular release

In the case where you want to modify the native code for an existing release of Chrome for Android (v25+) you can do the following steps. Note that in order to get your changes into the official release, you'll need to send your change for a codereview using the regular process for committing code to chromium.

  1. Open Chrome on your Android device and visit chrome://version
  2. Copy down the id listed next to "Build ID:"
  3. Go to http://storage.googleapis.com/chrome-browser-components/BUILD_ID_FROM_STEP_2/index.html
  4. Download the listed files and follow the steps in the readme.


原创粉丝点击