| | 1 | [[PageOutline]] |
| | 2 | = How To Build AndroidBOINC = |
| | 3 | |
| | 4 | This document describes, how to build the BOINC Client/Manager AndroidBOINC |
| | 5 | for Android-powered devices. |
| | 6 | |
| | 7 | To learn more about this project and it's architecture, see *link* |
| | 8 | |
| | 9 | |
| | 10 | = Introduction = |
| | 11 | |
| | 12 | == Naming convention == |
| | 13 | |
| | 14 | AndroidBOINC - Android application that bundles a cross compiled BOINC Client |
| | 15 | together with a Android-specific BOINC Manager (GUI). |
| | 16 | BOINC apps - scientific applications to be distributed and |
| | 17 | calculated on participating devices. |
| | 18 | |
| | 19 | |
| | 20 | == Requirements == |
| | 21 | |
| | 22 | * recommended IDE for Android development is Eclipse with ADT plugin |
| | 23 | * Android SDK: http://developer.android.com/sdk/ |
| | 24 | * Android NKD: http://developer.android.com/tools/sdk/ndk/index.html |
| | 25 | * BOINC Client source code: http://boinc.berkeley.edu/trac/wiki/SourceCode |
| | 26 | * AndroidBOINC source code: http://boinc.berkeley.edu/trac/wiki/SourceCode |
| | 27 | * AndroidBOINC build script: *link* |
| | 28 | |
| | 29 | |
| | 30 | == Used versions == |
| | 31 | |
| | 32 | Development target: |
| | 33 | * ARM architecture featuring ABI v5 |
| | 34 | * NDK-level 4 (Android 1.6) |
| | 35 | |
| | 36 | Tested with: |
| | 37 | * ARM ABI v7 device (Samsung Galaxy SII) |
| | 38 | * Android platform 2.3.4 |
| | 39 | |
| | 40 | |
| | 41 | = Building BOINC Client = |
| | 42 | |
| | 43 | == Setup NDK toolchain == |
| | 44 | |
| | 45 | In order to run the BOINC Client on Android-powered devices, |
| | 46 | it is necessary to compile it with the according cross compilation toolchain. |
| | 47 | This toolchain differs depending on the targeted Android platform version |
| | 48 | and CPU architecture. |
| | 49 | |
| | 50 | The Android NDK offers a script to build a standalone redistributable toolchain, |
| | 51 | including the binaries of the cross compilation tools and the sysroot |
| | 52 | (headers and libraries which are present on the targeted Android device, |
| | 53 | for more information see "Android NDK stable APIs"). |
| | 54 | To do so, run the following command from the Android NDK root directory: |
| | 55 | {{{ |
| | 56 | build/tools/make-standalone-toolchain.sh --platform=android-4 --install-dir=/tmp/tc |
| | 57 | }}} |
| | 58 | This will install a toolchain for ARM devices |
| | 59 | (default, use e.g. "--arch=x86" to change) with minimum Android version 1.6 |
| | 60 | in the given installation directory. |
| | 61 | |
| | 62 | A map of NDK Android platform version (e.g. android-4) |
| | 63 | to common Android versions (e.g. Android 1.6) can be found in under "Stable APIs" |
| | 64 | of the Android NDK documentation. |
| | 65 | |
| | 66 | |
| | 67 | == Build Client using script == |
| | 68 | |
| | 69 | With the compilation toolchain ready, proceed with actually building the BOINC Client. |
| | 70 | The BOINC repository provides a build script, |
| | 71 | which sets up the paths and invokes the building tools. |
| | 72 | |
| | 73 | Before first execution, configure the build script with the following information: |
| | 74 | |
| | 75 | * BPNAME: name of the BOINC platform. |
| | 76 | This can be use to distinct different Android architecutres or platform |
| | 77 | versions by your project's scheduler. (use e.g. "android-arm-4") |
| | 78 | * ANDROIDTC: location of the standalone toolchain, set up in 1.1 |
| | 79 | * OPENSSL: location of openSSL sources, openSSL is required by BOINC Client. |
| | 80 | (Tested with version 1.0.0d) |
| | 81 | * CURL: location of CURL sources, Curl is required by BOINC Client. |
| | 82 | (Tested with 7.27.0) |
| | 83 | * BOINC: location of BOINC sources, no adjustments for Android necessary, |
| | 84 | use source code from BOINC repository |
| | 85 | * BAPP: location of BOINC app, optional. Not required to build the Client. |
| | 86 | * BOINCINSTALL: destination directory for BOINC binaries. |
| | 87 | * TARGETAPK: location of AndroidBOINC sources. |
| | 88 | Script copies the BOINC Client binary to the Android project's "assets" directory. |
| | 89 | |
| | 90 | Run script and verify that "boinc_client" executable got created. |
| | 91 | Note that it will not run on your development machine, if you target the ARM architecture. |
| | 92 | |
| | 93 | |
| | 94 | = Building AndroidBOINC = |
| | 95 | |
| | 96 | AndroidBOINC consists of an Android-specific BOINC Manager |
| | 97 | (GUI, written in Java using the Android Application Framework API) |
| | 98 | bundled with cross compiled BOINC Client binaries (see section 1). |
| | 99 | This section describes, how to build the Android application. |
| | 100 | |
| | 101 | |
| | 102 | == Setup Android SDK == |
| | 103 | |
| | 104 | Step-by-step instructions on how to set up the Android development environment, |
| | 105 | including Android SDK, development tools, Android platforms, |
| | 106 | Eclipse and ADT plugin can be found here: |
| | 107 | http://developer.android.com/sdk/installing/index.html |
| | 108 | |
| | 109 | |
| | 110 | == Customize AndroidBOINC == |
| | 111 | |
| | 112 | AndroidBOINC is able to attach to a single project only. |
| | 113 | This is a limitation of the Android Manager, rather then the BOINC Client. |
| | 114 | In order to provide AndroidBOINC for your project, |
| | 115 | the very basic modifications to the Android app are: |
| | 116 | |
| | 117 | * adapt the default project URL & name |
| | 118 | (located at *android.package.name*/res/values/strings.xml) |
| | 119 | |
| | 120 | Of course you are free to adapt the Manager to suit the needs of your project, e.g.: |
| | 121 | * rename application |
| | 122 | * adapt graphical identity |
| | 123 | * translate to other language |
| | 124 | |
| | 125 | If you make major improvements to AndroidBOINC, |
| | 126 | please consider sharing them with the community! |
| | 127 | |
| | 128 | |
| | 129 | == Remarks on changing package name == |
| | 130 | |
| | 131 | If you want to change the Android application's package name, |
| | 132 | be advised that you also have to adapt the working directory |
| | 133 | in the sources of the BOINC Client. |
| | 134 | The working directory is defined in *boinc-client-sources*/lib/android_log.h. |
| | 135 | |
| | 136 | The working directory is defined with the pattern: |
| | 137 | "/data/data/*android.package.name*/client" |
| | 138 | |
| | 139 | Re-compile BOINC Client for changes to take effect. |
| | 140 | |
| | 141 | |
| | 142 | == Building Android BOINC Manager == |
| | 143 | |
| | 144 | Make sure, that the cross compiled BOINC Client resides in your Android project's |
| | 145 | "assets" directory. |
| | 146 | Building the Android project in Eclipse will bundle the Client's binaries |
| | 147 | into the Android application's APK file. |
| | 148 | |
| | 149 | |
| | 150 | = Debugging = |
| | 151 | |
| | 152 | Both components of AndroidBOINC, the BOINC Client and the BOINC Manager, |
| | 153 | use Logcat to write debugging messages. |
| | 154 | |
| | 155 | If you are using an Android emulator (AVD) to debug your project, note the following: |
| | 156 | |
| | 157 | * AVD is by default ARM ABI v5. |
| | 158 | * AVD does not support wifi, the data connection of the development machine |
| | 159 | is tunneled to the cellular connection of the emulator. |
| | 160 | Be adviced, that AndroidBOINC's default configuration allows |
| | 161 | project work unit transfers only when wifi is connected! |
| | 162 | To change this behavior, go to application's "settings" tab. |
| | 163 | * Internal memory and RAM are very little on an AVD. |
| | 164 | Note that most common Android smartphones have higher capabilities. |
| | 165 | |
| | 166 | To adapt an AVD instance, in terms of available RAM, internal memory, |
| | 167 | Android platform version or ARM ABI version, see: |
| | 168 | http://developer.android.com/tools/devices/index.html |
| | 169 | |
| | 170 | |
| | 171 | = Next steps = |
| | 172 | |
| | 173 | * build your scientific BOINC apps for Android (see *link*). |
| | 174 | Keep in mind, that the Android platform and architecture settings |
| | 175 | have to be the same for both, the AndroidBOINC and the BOINC apps. |
| | 176 | The compatibility of the device gets only checked, |
| | 177 | when AndroidBOINC is installed on a device, unsupported scientific apps |
| | 178 | will not be detected and are likely to crash on some devices. |
| | 179 | Use "BOINC platform" configuration of the build script, |
| | 180 | to distinct versions with project scheduler. |
| | 181 | * configure project scheduler to distribute BOINC apps for AndroidBOINC. |
| | 182 | * submit AndroidBOINC to an app store or distribute APK independently. |