Skip to content


Folders and files

Last commit message
Last commit date

Latest commit


Repository files navigation

Swift Android Toolchain Download

Automated scripts to build Swift Android cross compilation toolchain for macOS


Prebuilt toolchains are located on Github Releases

Prepare environment (macOS x86_64 or macOS arm64)

  1. [IMPORTANT] Swift Android Toolchain uses the macOS Swift toolchain. That's why it will work ONLY with the proper version of the host toolchain. There are 2 options on how to switch the default toolchain to a proper version:
  1. Install NDK and Swift Android Toolchain.
sdkmanager --install "ndk;25.2.9519653"
  • otherwise:
curl -O
hdiutil attach android-ndk-r25c-darwin.dmg
cp -r "/Volumes/Android NDK r25c/" ./android-ndk-r25c
hdiutil detach "/Volumes/Android NDK r25c"
  1. Install Swift Android Toolchain
curl -L -O
swift-android/bin/swift-android tools --update
  1. Setup environment variables by adding:
export PATH=$SWIFT_ANDROID_HOME/bin:$SWIFT_ANDROID_HOME/build-tools/current:$PATH

Build and Test swift modules

Our current swift build system is tiny wrapper over Swift PM. See Swift PM docs for more info.

Command Description
swift package clean Clean build folder
swift package update Update dependencies
swift-build Build all products
swift-build --build-tests Build all products and tests
swift-test Connect to Android device and run all tests

swift-build wrapper scripts works as swift build from swift package manager but configured for android. So you can add any extra params like -Xswiftc -DDEBUG , -Xswiftc -suppress-warnings or --configuration release

Example of compilation flags:


swift-build --configuration debug \
    -Xswiftc -DDEBUG \
    -Xswiftc -Xfrontend -Xswiftc -experimental-disable-objc-attr


swift-build --configuration release \
    -Xswiftc -Xfrontend -Xswiftc -experimental-disable-objc-attr \
    -Xswiftc -Xllvm -Xswiftc -sil-disable-pass=array-specialize

Build swift modules with Android Studio

This plugin integrates Swift Android Toolchain to Gradle

Other swift releated projects and articles

  1. Swift for Android: Our Experience and Tools
  2. Anotation Processor for generating JNI code
  3. Cross-platform swift weather app