Version 13 (modified by 10 years ago) (diff) | ,
---|
How To Build BOINC for Android
This document describes how to build BOINC for Android, which consists of a cross-compiled BOINC Client together with an Android-specific GUI (written in Java using the Android Application Framework API).
See AndroidBoincImpl for a description of the architecture of BOINC for Android.
See AndroidBuildApp for info on building science applications for BOINC for Android.
Introduction
Requirements
- The recommended IDE for Android development is Eclipse with ADT plugin
- Android SDK: http://developer.android.com/sdk/ (not needed for building science apps)
- Android NDK: http://developer.android.com/tools/sdk/ndk/index.html
- BOINC Client source code: http://boinc.berkeley.edu/trac/wiki/SourceCodeGit
Versions we used
Development target:
- ARM architecture featuring ABI v5
- NDK-level 9 (Android 2.3)
Tested with:
- ARM ABI v7 device (Samsung Galaxy SII)
- Android platform 2.3.4
Building BOINC Client
Set up NDK toolchain
To run the BOINC Client on Android-powered devices, it is necessary to compile it with a cross compilation toolchain. This toolchain differs depending on the targeted Android platform version and CPU architecture.
The Android NDK offers a script to build a standalone redistributable toolchain, including the binaries of the cross compilation tools and the sysroot (headers and libraries which are present on the targeted Android device, for more information see "Android NDK stable APIs").
Our build scripts depend on the NDKROOT environment variable to point to the installed NDK. Please make sure that environment variable is set before executing the build_androidtc.sh shell script.
Run the following command from the boinc/android directory:
./build_androidtc.sh
This will install a toolchain for ARM devices with minimum Android version 2.3 in the ~/android-tc directory.
A map of NDK Android platform version (e.g. android-9) to common Android versions (e.g. Android 2.3) can be found in under "Stable APIs" in the Android NDK documentation.
Build the Client
With the compilation toolchain ready, proceed with actually building the BOINC Client. The BOINC repository provides a build script, which sets up the paths and invokes the building tools.
Before first execution, configure the build script with the following information:
- OPENSSL(build_openssl.sh): location of openSSL sources, openSSL is required by BOINC Client. (Tested with version 1.0.0d)
- CURL(build_curl.sh): location of CURL sources, Curl is required by BOINC Client. (Tested with 7.27.0)
Run the following command from the boinc/android directory:
./build_all.sh
To build only the client, run the following command from the boinc/android directory:
./build_boinc.sh
Verify that the "boinc" executable was created and copied to boinc/android/BOINC/assets. Note that it will not run on your development machine.
To build only the libraries, run the following command from the boinc/android directory. You need build openssl before and adapt the build_libraries.sh to point to your openssl. Curl is not needed:
./build_libraries.sh
Building BOINC for Android
This section describes how to build the Android application.
Setup Android SDK
Step-by-step instructions on how to set up the Android development environment, including Android SDK, development tools, Android platforms, Eclipse and ADT plugin can be found here: http://developer.android.com/sdk/installing/index.html
Building the project
Make sure that the cross compiled BOINC Client resides in your Android project's "assets" directory. Building the Android project in Eclipse will bundle the Client's binaries into the Android application's APK file.
Debugging
Both components of BOINC for Android , the BOINC Client and the GUI, use Logcat to write debugging messages.
If you are using an Android emulator (AVD) to debug your project, note the following:
- AVD is by default ARM ABI v5.
- AVD does not support wifi; the data connection of the development machine is tunneled to the cellular connection of the emulator. Be advised that BOINC for Android's default configuration allows project work unit transfers only when wifi is connected! To change this behavior, go to application's "settings" tab.
- Internal memory and RAM are very small on an AVD. Note that most common Android smartphones have higher capabilities.
To adapt an AVD instance, in terms of available RAM, internal memory, Android platform version or ARM ABI version, see: http://developer.android.com/tools/devices/index.html
Next steps
- build your scientific BOINC apps for Android. Keep in mind that the Android platform and architecture settings have to be the same for both, the BOINC for Android and the BOINC apps. The compatibility of the device gets checked, when BOINC for Android is installed on a device; unsupported scientific apps will not be detected and are likely to crash on some devices. Use "BOINC platform" configuration of the build script, to distinguish versions with project scheduler.