https://code.google.com/p/chromium/wiki/AndroidBuildInstructions
AndroidBuildInstructions
Build instructions for Chromium for Android
Prerequisites
Getting the codeYou 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 until build/android/envsetup.sh has been run. gclient sync --nohooks . build/android/envsetup.sh gclient runhooks If you are testing a feature requiring API keys, install API keys as in the Linux instructions. Install prerequisitesThe 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/build sudo ./install-build-deps-android.sh In addition, you must manually install the Oracle Java JDK and configure it to be the default Java compiler:
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 50000 sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.6.0_38/bin/java 50000 sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk1.6.0_38/bin/javaws 50000 sudo update-alternatives --install /usr/bin/javap javap /usr/lib/jvm/jdk1.6.0_38/bin/javap 50000 sudo update-alternatives --config javac sudo update-alternatives --config java sudo update-alternatives --config javaws sudo 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
To build the ARM Android content shell: . build/android/envsetup.sh android_gyp ninja -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=x86 android_gyp ninja -C out/Release -j10 content_shell_apk Enable USB debugging on your Android deviceOn 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 enabled GPU emulation in Hardware settings of the AVD being used. Installing Content ShellSee 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 --release build/android/adb_run_content_shell build/android/adb_gdb_content_shell To pass command-line flags to the content-shell: build/android/adb_content_shell_command_line 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_testshell build/android/adb_install_apk.py --apk ChromiumTestShell.apk --release build/android/adb_run_chromium_testshell build/android/adb_gdb_chromium_testshell To pass command-line flags to the testshell: build/android/adb_chromium_testshell_command_line Running Unit Testsninja -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 test build/android/run_tests.py -s base_unittests -f PathUtilTest.BasicTest Running Instrumentation Testsninja -C out/Release -j10 content_shell_apk android_builder_tests build/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 testsninja -C out/Release -j10 content_browsertests_apk build/android/run_browser_tests.py --verbose --num_retries=1 # Running a particular test build/android/run_browser_tests.py --verbose --num_retries=1 -f SessionHistoryTest.JavascriptHistory Rebuilding libchromeview.so for a particular releaseIn 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.
|