Skip to content

AndroidBuildClient

Vitalii Koshura edited this page Apr 9, 2023 · 2 revisions

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

Versions we used

Development target:

  • ARM architecture featuring v7a (with VFP and/or NEON support)
  • NDK-level 16 (Android 4.1)

Tested with:

  • ARM ABI v7 device (HTC One X+)
  • Android platform 4.2.2

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 NDK_ROOT environment variable to point to the installed NDK. Please make sure that environment variable is set before executing any of the build_androidtc_\<ARCH>.sh shell scripts.

Run on of the following commands from the <BOINC_REPO>/android directory:

./build_androidtc_[arm|arm64|mips|mips64|x86|x86_64].sh

Alternatively you can build the NDK toolchains together with the BOINC client itself by running the ./build_all.sh script as described in the next section.

This will install a toolchain for the selected architecture with minimum Android version 4.1 in the directory defined by the ANDROID_TC environment variable (default: ~/android-tc).

A map of NDK Android platform version (e.g. android-16) to common Android versions (e.g. Android 4.1) can be found in Android Guides.

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 via the following environment variables:

  • OPENSSL_SRC: location of OpenSSL sources, OpenSSL is required by BOINC Client. (Tested with version 1.0.0d)
  • CURL_SRC: location of cURL sources, cURLl is required by BOINC Client. (Tested with 7.27.0)

Run the following command from the <BOINC_REPO>/android directory to build the NDK toolchains, the BOINC client and all its dependencies:

./build_all.sh

To build the client, run the following command from the <BOINC_REPO>/android directory:

./build_boinc_all.sh

Verify that the boinc executables were created and copied to <BOINC_REPO>/android/BOINC/app/src/main/assets (per architecture). Note that they will not run on your development machine.

To build only the libraries, run one of the following commands from the <BOINC_REPO>/android directory. Remember to define OPENSSL_SRC and let it point to the location of the OpenSSL sources.

./build_libraries_[arm|mips|x86].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 Android Studio, including Android SDKs, development tools and Android platforms can be found here: http://developer.android.com/sdk/installing/index.html

Building the project

Make sure that the cross compiled BOINC Client executables reside in your Android project's <BOINC_REPO>/android/BOINC/app/src/main/assets directory. Building the Android project in Android Studio 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 Virtual Device emulator (AVD) to debug your project, note the following:

  • Make sure you pick the right API level
  • 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.
  • The AVD might not run within a virtual machine since it uses virtualization itself (which can't be nested).

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.
Clone this wiki locally