The first Swift 6.3 Android SDK snapshot bundle was just released! ![]()
This includes the recent addition of availability checking for Android in the compiler!
With this feature you can now gate code behind the @available or #available helpers that you know from other platforms! It also works for the Android C standard lib (Bionic) functions, which have been marked as introduced in a specific API version. Giving you static compile time checking that the methods are available.
#if canImport(Android)
import Android
#endif
@available(Android 28, *)
func availableIn28() {
if #available(Android 33, *) {
// Call Android 33+ method
withUnsafeTemporaryAllocation(of: UnsafeMutableRawPointer.self, capacity: 1) { address in
_ = backtrace(address.baseAddress!, 1) // Bionic backtrace is only available on API 33+
}
} else {
// Fallback
}
}
Please also see the additional installation instructions below. If you want to use this availability checking for the C standard lib functions, you must link with NDK 28 instead of 27.
Please try it out, and file any issues you might face!
Installation
Make sure the corresponding Swift version is installed:
swiftly install 6.3-snapshot-2025-12-07
swiftly use 6.3-snapshot-2025-12-07
Install the Android SDK:
swift sdk install https://download.swift.org/swift-6.3-branch/android-sdk/swift-6.3-DEVELOPMENT-SNAPSHOT-2025-12-07-a/swift-6.3-DEVELOPMENT-SNAPSHOT-2025-12-07-a_android.artifactbundle.tar.gz --checksum e97d74eb58c209bff135e69e75d7c440a4acb71099cb9c5b119863c8b6b3f833
Install and configure the Android NDK. This is where you must link against NDK 28, instead of 27, if you want to use the new availability feature for C standard lib functions.
mkdir ~/android-ndk
cd ~/android-ndk
curl -fSLO https://dl.google.com/android/repository/android-ndk-r28c-$(uname -s).zip
unzip -q android-ndk-r28c-*.zip
export ANDROID_NDK_HOME=$PWD/android-ndk-r28c
After this you must run the configure script from the Android SDK
cd ~/Library/org.swift.swiftpm || cd ~/.swiftpm
./swift-sdks/swift-6.3-DEVELOPMENT-SNAPSHOT-2025-12-07-a_android.artifactbundle/swift-android/scripts/setup-android-sdk.sh
You are now all setup to use the new Swift Android SDK! ![]()