Prerequisites ------------- - Android SDK - Android NDK - Python - Other requirements that are obtained during this guide - LDNS - Unbound - OpenSSL Supported Components -------------------- - Swiften Note: File-transfer support has not been tested on Android. Link-local features are not supported under Android. Supported Android NDK Level --------------------------- The minimal supported Android NDK API level is 14 (see --platform parameter of make-standalone-toolchain.sh). This is the NDK API level associated with Android 4.0. Higher Android NDK API levels however should work. Preparation of Build Environment -------------------------------- 1. Fetch 3rd-party dependencies 1.1 LDNS cd 3rdParty/Ldns bash prepare_ldns.sh 1.2 Unbound cd 3rdParty/Unbound bash prepare_unbound.sh 1.3 OpenSSL cd 3rdParty/OpenSSL curl -O http://www.openssl.org/source/openssl-1.0.0a.tar.gz tar -xf openssl-1.0.0a.tar.gz mv openssl-1.0.0a openssl 2. Patch 3rd-party dependencies patch -p0 < 3rdParty/Ldns/01_andoird_compilation_fixes.diff patch -p1 < 3rdParty/LibMiniUPnPc/01_android_compilation_fixes.diff patch -p1 < 3rdParty/Unbound/01_android_fixes.diff 3. Create Android NDK Toolchain cd $ANDROID_NDK_ROOT (this is the folder where you extracted Android NDK) bash ./build/tools/make-standalone-toolchain.sh --platform=android-14 --install-dir=$HOME/android-14-tc Configuring Swift Build ----------------------- 1. Set config.py to (probably other paths, replace $NDK_TOOLCHAIN_INSTALL_DIR with the expanded path of the install dir used in the previous step): > android_toolchain=$NDK_TOOLCHAIN_INSTALL_DIR > android_sdk_bin="/usr/local/bin" > target = "android" > unbound = 1 Building -------- ./scons test=none Swiften Swift/Controllers QA max_jobs=1 Testing ------- Running Swift's test suite on Android requires a one time preparation of a testing environment. This creates an Android VM where the test will be deployed to and run on. 1. Preparation of test environment (one time) 1.1 Starting AVD (Android Device Manager) android avd 1.2 Create a test VM Click "Create..." button 1.3 Fill out dialog AVD Name: swift_test Device: Nexus 4 Target: Anything with API level equal or greater than your toolchain you build CPU/ABI: ARM (unless you build a different toolchain) Click "Ok" button 1.4 Close AVD 2. Running integration and unit tests To run the unit tests you need to have an Android VM running while the test suite is running. This requires to leave the command under step 2.1 running while you execute step 2.2. Running the test suite on Android can take quite some time ( >30 minutes ) compared to a native run. This is due to a) the slow transfer speed from host machine to VM (~ 2 MB/s) and b) the test environment being emulated for an different CPU architecture. 2.1 Start Android VM with resized /system partition emulator -partition-size 2048 @swift_test 2.2 Run integration and unit tests (wait until the android boot screen is gone) env SWIFT_CLIENTTEST_JID="some jabber id" SWIFT_CLIENTTEST_PASS="password for the jabber id" ./scons test=all Swiften Swift/Controllers QA