tree: a1f86888d2f2da8dec7663d40a9d03be11077f20 [path history] [tgz]

Android Port of Foundation module

This directory contains scripts used in the port of Foundation to an Android toolchain. The short version of the story is that after downloading the swift sources use the script “” in this directory to install prebuilt binaries and headers for libxml, libcurl and libdispatch then run the script “”.

This build requires the path to a r12 Android NDK in the ANDROID_NDK_HOME environment variable and the path to the android port of the “icu” libraries in ANDROID_ICU_UC downloaded from here. The port was tested against api 21 on a Android v5.1.1 LG K4 Phone (Lollipop) and requires an Ubuntu 15 host with the Android NDK Gold linker from toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/arm-linux-androideabi/bin installed as /usr/bin/

The pre-built binaries were built from the following repos:

To build these the recipe was generally the same. autogen or configure for Linux then alter their Makefiles to have CFLAGS = include: --target=armv7-none-linux-androideabi --sysroot=$(ANDROID_NDK_HOME)/platforms/android-21/arch-arm.

There is a known issue when libdispatch background tasks exit they will cause an exception as DetachCurrentThread has not been called. To avoid this your app must include the line:

DispatchGroup.threadCleanupCallback = JNI_DetachCurrentThread

JNI_DetachCurrentThread is available in the package java_swift available here:

Pre-built binaries of an Swift compiler with support for Android including Foundation available here:

Other resources

Check out the SwiftAndroid and SwiftJava github projects for starter Android applications and resources.