- Download and install the .pkg toolchain from https://www.swift.org/install
- Get the SDK URL from https://github.com/swift-android-sdk/swift-android-sdk.git
- The toolchain and SDK must be the same version (for development snapshots, the date and version must match)
- Install the SDK with
swift sdk install
- Install sdkmanager:
brew install --cask android-commandlinetools - Set up paths to commands:
echo -n 'export ANDROID_HOME=/opt/homebrew/share/android-commandlinetools\n' >> ~/.zshrcecho -n 'export PATH=${ANDROID_HOME}/platform-tools:$PATH\n' >> ~/.zshrcecho -n 'export PATH=${ANDROID_HOME}/emulator:$PATH\n' >> ~/.zshrc
- Install dependancies:
sdkmanager --install 'system-images;android-35;default;arm64-v8a' 'emulator' 'cmdline-tools;latest' 'build-tools;35.0.1' 'platforms;android-35' 'platform-tools' 'ndk;28.2.13676358' - Create an emulator:
avdmanager create avd -n test -k 'system-images;android-35;default;arm64-v8a'and launchemulator -avd test
- Set your SDK path at
<android-sdk>and run script:ANDROID_NDK_HOME=/opt/homebrew/share/android-commandlinetools/ndk/28.2.13676358 ~/Library/org.swift.swiftpm/swift-sdks/<android-sdk>.artifactbundle/swift-android/scripts/setup-android-sdk.sh - Modify
makefilearguments according to your preferences - Create a signing key with
make keystore
- Modify
build: aarch64tobuild: armv7 aarch64 x86_64if you want to build all three architectures - Add missing dependencies to
LIBRARIESif you want to use Foundation library, for example. You can identify missing dependencies by checking for dlopen errors inadb logcat - Finally,
make runto build, archive, install, run and log application