Releases: skiptools/swift-android-toolchain
6.2
Installing the Swift Android SDK
First install the matching Swift 6.2 toolchain from https://swift.org/download/#releases and add it to your PATH, or by using swiftly:
swiftly install 6.2
Then install the Swift Android SDK by running the command:
swift sdk install https://github.com/skiptools/swift-android-toolchain/releases/download/6.2/swift-6.2-RELEASE-android-0.1.artifactbundle.tar.gz --checksum 52cfebf048b8fe732403c98474908a3f237913cbba9e3fcef3f90ee732bf2cec
Installing the Android NDK
The Swift Android SDK requires the Android Native Development Toolkit (NDK) to function, which must be installed separately. Download and unzip the r27c LTS release and set the ANDROID_NDK_HOME environment variable to the local NDK installation and run the setup script.
macOS configuration command for android-ndk-r27c-darwin.zip:
ANDROID_NDK_HOME=~/Downloads/android-ndk-r27c ~/Library/org.swift.swiftpm/swift-sdks/swift-6.2-RELEASE-android-0.1.artifactbundle/swift-android/scripts/setup-android-sdk.sh
Linux configuration command for android-ndk-r27c-linux.zip:
ANDROID_NDK_HOME=~/android-ndk-r27c ~/.swiftpm/swift-sdks/swift-6.2-RELEASE-android-0.1.artifactbundle/swift-android/scripts/setup-android-sdk.sh
GitHub Actions:
~/.swiftpm/swift-sdks/swift-6.2-RELEASE-android-0.1.artifactbundle/swift-android/scripts/setup-android-sdk.sh
Note
GitHub Actions already includes the Android NDK and defines ANDROID_NDK_HOME, so there is no need to install the NDK separately. Alternatively, you can use the swift-android-action to build Swift packages and run Android tests from a GitHub workflow.
Building Swift Packages for Android
Now you can compile a Swift package for Android with:
$ git clone https://github.com/apple/swift-algorithms.git
$ cd swift-algorithms/
$ swiftly run swift build --swift-sdk aarch64-unknown-linux-android28 +6.2
Running Swift Executables on Android
If you have a connected Android device with USB debugging enabled, or are running an Android emulator, you can create and run a Swift executable with the following commands:
$ mkdir ExecutableDemo
$ cd ExecutableDemo
$ swift package init --type executable
$ swiftly run swift build --static-swift-stdlib --swift-sdk aarch64-unknown-linux-android28 +6.2
$ adb push .build/debug/ExecutableDemo /data/local/tmp/
$ adb push ${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/*/sysroot/usr/lib/aarch64-linux-android/libc++_shared.so /data/local/tmp/
$ adb shell /data/local/tmp/ExecutableDemo
6.2-DEVELOPMENT-SNAPSHOT-2025-08-28-a
Installing the Swift Android SDK
First install the matching Swift 6.2-snapshot-2025-08-28-a toolchain from https://swift.org/download/#releases and add it to your PATH, or by using swiftly:
swiftly install 6.2-snapshot-2025-08-28-a
Then install the Swift Android SDK by running the command:
swift sdk install https://github.com/skiptools/swift-android-toolchain/releases/download/6.2-DEVELOPMENT-SNAPSHOT-2025-08-28-a/swift-6.2-DEVELOPMENT-SNAPSHOT-2025-08-28-a-android-0.1.artifactbundle.tar.gz --checksum 546078395418c13e9f79618f1d8f33df24658d32755e3fc51febf78b43f73b9d
Installing the Android NDK
The Swift Android SDK requires the Android Native Development Toolkit (NDK) to function, which must be installed separately. Download and unzip the r27c LTS release and set the ANDROID_NDK_HOME environment variable to the local NDK installation and run the setup script.
macOS configuration command for android-ndk-r27c-darwin.zip:
ANDROID_NDK_HOME=~/Downloads/android-ndk-r27c ~/Library/org.swift.swiftpm/swift-sdks/swift-6.2-DEVELOPMENT-SNAPSHOT-2025-08-28-a-android-0.1.artifactbundle/swift-android/scripts/setup-android-sdk.sh
Linux configuration command for android-ndk-r27c-linux.zip:
ANDROID_NDK_HOME=~/android-ndk-r27c ~/.swiftpm/swift-sdks/swift-6.2-DEVELOPMENT-SNAPSHOT-2025-08-28-a-android-0.1.artifactbundle/swift-android/scripts/setup-android-sdk.sh
GitHub Actions:
~/.swiftpm/swift-sdks/swift-6.2-DEVELOPMENT-SNAPSHOT-2025-08-28-a-android-0.1.artifactbundle/swift-android/scripts/setup-android-sdk.sh
Note
GitHub Actions already includes the Android NDK and defines ANDROID_NDK_HOME, so there is no need to install the NDK separately. Alternatively, you can use the swift-android-action to build Swift packages and run Android tests from a GitHub workflow.
Building Swift Packages for Android
Now you can compile a Swift package for Android with:
$ git clone https://github.com/apple/swift-algorithms.git
$ cd swift-algorithms/
$ swiftly run swift build --swift-sdk aarch64-unknown-linux-android28 +6.2-snapshot-2025-08-28-a
Running Swift Executables on Android
If you have a connected Android device with USB debugging enabled, or are running an Android emulator, you can create and run a Swift executable with the following commands:
$ mkdir ExecutableDemo
$ cd ExecutableDemo
$ swift package init --type executable
$ swiftly run swift build --static-swift-stdlib --swift-sdk aarch64-unknown-linux-android28 +6.2-snapshot-2025-08-28-a
$ adb push .build/debug/ExecutableDemo /data/local/tmp/
$ adb push ${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/*/sysroot/usr/lib/aarch64-linux-android/libc++_shared.so /data/local/tmp/
$ adb shell /data/local/tmp/ExecutableDemo
DEVELOPMENT-SNAPSHOT-2025-11-03-a
Installing the Swift Android SDK
First install the matching Swift main-snapshot-2025-11-03-a toolchain from https://swift.org/download/#releases and add it to your PATH, or by using swiftly:
swiftly install main-snapshot-2025-11-03-a
Then install the Swift Android SDK by running the command:
swift sdk install https://github.com/skiptools/swift-android-toolchain/releases/download/DEVELOPMENT-SNAPSHOT-2025-11-03-a/swift-DEVELOPMENT-SNAPSHOT-2025-11-03-a_android.artifactbundle.tar.gz --checksum d3525b67d6e4e9b1cdcb1dde18e5589680967ea646966050621ea4864f1efe91
Installing the Android NDK
The Swift Android SDK requires the Android Native Development Toolkit (NDK) to function, which must be installed separately. Download and unzip the r27c LTS release and set the ANDROID_NDK_HOME environment variable to the local NDK installation and run the setup script.
macOS configuration command for android-ndk-r27c-darwin.zip:
ANDROID_NDK_HOME=~/Downloads/android-ndk-r27c ~/Library/org.swift.swiftpm/swift-sdks/swift-DEVELOPMENT-SNAPSHOT-2025-11-03-a_android.artifactbundle/swift-android/scripts/setup-android-sdk.sh
Linux configuration command for android-ndk-r27c-linux.zip:
ANDROID_NDK_HOME=~/android-ndk-r27c ~/.swiftpm/swift-sdks/swift-DEVELOPMENT-SNAPSHOT-2025-11-03-a_android.artifactbundle/swift-android/scripts/setup-android-sdk.sh
GitHub Actions:
~/.swiftpm/swift-sdks/swift-DEVELOPMENT-SNAPSHOT-2025-11-03-a_android.artifactbundle/swift-android/scripts/setup-android-sdk.sh
Note
GitHub Actions already includes the Android NDK and defines ANDROID_NDK_HOME, so there is no need to install the NDK separately. Alternatively, you can use the swift-android-action to build Swift packages and run Android tests from a GitHub workflow.
Building Swift Packages for Android
Now you can compile a Swift package for Android with:
$ git clone https://github.com/apple/swift-algorithms.git
$ cd swift-algorithms/
$ swiftly run swift build --swift-sdk aarch64-unknown-linux-android28 +main-snapshot-2025-11-03-a
Running Swift Executables on Android
If you have a connected Android device with USB debugging enabled, or are running an Android emulator, you can create and run a Swift executable with the following commands:
$ mkdir ExecutableDemo
$ cd ExecutableDemo
$ swift package init --type executable
$ swiftly run swift build --static-swift-stdlib --swift-sdk aarch64-unknown-linux-android28 +main-snapshot-2025-11-03-a
$ adb push .build/debug/ExecutableDemo /data/local/tmp/
$ adb push ${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/*/sysroot/usr/lib/aarch64-linux-android/libc++_shared.so /data/local/tmp/
$ adb shell /data/local/tmp/ExecutableDemo
6.1.1
Install this SDK by installing the matching Swift 6.1.1 toolchain from https://swift.org/download/#releases and add it to your PATH, or by using swiftly:
swiftly install 6.1.1
Then install the Android SDK by running the command:
swift sdk install https://source.skip.tools/swift-android-toolchain/releases/download/6.1.1/swift-6.1.1-RELEASE-android-0.1.artifactbundle.tar.gz --checksum cc5ed104653f4aceaa1acd3d162acc45921f77ed2a5dddaaeb66ef1e62d630a0
Next, install the Android NDK r27c LTS release and set the ANDROID_NDK_HOME environment variable to the local NDK installation and run the setup script. For example, on macOS, run:
ANDROID_NDK_HOME=~/Library/Android/sdk/ndk/27.0.12077973 ~/Library/org.swift.swiftpm/swift-sdks/swift-6.1.1-RELEASE-android-0.1.artifactbundle/swift-android/scripts/setup-android-sdk.sh
Now you can compile your Swift package for Android with:
swiftly run swift build --swift-sdk aarch64-unknown-linux-android28 +6.1.1
6.1
Install this SDK by installing the Swift 6.1 toolchain from https://swift.org/download/#releases and then running the command:
swift sdk install https://source.skip.tools/swift-android-toolchain/releases/download/6.1/swift-6.1-RELEASE-android-24-0.1.artifactbundle.tar.gz --checksum f8696e3e84111b8c2c6f6e564b6266357987ea8d4aa3b2cf92f144357acde1c9
6.0.3
Install this SDK on macOS or Linux by installing the Swift 6.0.3 toolchain from https://swift.org/download/#releases and then running the command:
swift sdk install https://source.skip.tools/swift-android-toolchain/releases/download/6.0.3/swift-6.0.3-RELEASE-android-24-0.1.artifactbundle.tar.gz --checksum 4566f23ae2d36dc5c02e915cd67d83b2af971faca4b2595fdd75cf0286acfac1
6.0.2
Install this SDK on macOS or Linux by installing the Swift 6.0.2 toolchain from https://swift.org/download/#releases and then running the command:
swift sdk install https://source.skip.tools/swift-android-toolchain/releases/download/6.0.2/swift-6.0.2-RELEASE-android-24-0.1.artifactbundle.tar.gz --checksum d75615eac3e614131133c7cc2076b0b8fb4327d89dce802c25cd53e75e1881f4