DEV Community

Cover image for Swift SDK for Android is Here: Build Native Android Apps with Swift
ArshTechPro
ArshTechPro

Posted on

Swift SDK for Android is Here: Build Native Android Apps with Swift

Big news for mobile developers: Swift can now officially target Android. The Swift.org team just released nightly preview builds of the Swift SDK for Android, marking a significant milestone for cross-platform development. This isn't a community hack or experimental fork—it's official tooling that lets you write native Android applications using Swift.

What Just Launched?

The Swift SDK for Android is available today, bundled with the Windows installer or downloadable separately for use on Linux or macOS. This release reflects months of coordinated effort building on years of grassroots community work.

The SDK enables developers to:

  • Write Android applications in Swift
  • Share code between iOS and Android platforms
  • Access Android APIs through Swift-Java interoperability
  • Build native Android binaries using cross-compilation

Why Swift on Android Matters

Swift has matured significantly over the past decade—extending from cloud services to Windows applications, browser apps, and microcontrollers. Thanks to its strong interoperability features, Swift code can be shared across platforms, reducing duplication and maintenance overhead.

For developers juggling iOS and Android codebases, this opens new possibilities:

  • Unified business logic across platforms
  • Reduced code duplication for core functionality
  • Faster feature parity between iOS and Android apps
  • Leveraging existing Swift expertise on Android projects

The Ecosystem is Already Growing

Here's something impressive: over 25% of packages in the Swift Package Index already build for Android, and the Community Showcase now indicates Android compatibility. This means you're not starting from zero—there's already a substantial collection of Swift packages ready to use in your Android projects.

Getting Started: Three Components You Need

To cross-compile Swift code for Android, you need three separate components: the Host Toolchain (swift command and related tools), the Swift SDK for Android (libraries, headers, and resources for Android target), and the Android NDK (Native Development Kit with cross-compilation tools).

The Getting Started guide walks you through:

  • Installing the matching host toolchain and SDK versions
  • Setting up the Android NDK
  • Configuring your development environment
  • Cross-compiling your first Swift code for Android

Quick Example: Cross-Compilation in Action

Once set up, building for Android is straightforward:

# Build for Android x86_64
$ swift build --swift-sdk x86_64-unknown-linux-android28 --static-swift-stdlib

# Build for Android ARM64
$ swift build --swift-sdk aarch64-unknown-linux-android28 --static-swift-stdlib
Enter fullscreen mode Exit fullscreen mode

The output is native Android binaries ready to run on devices or emulators.

Five Real-World Examples to Explore

The swift-android-examples repository provides practical demonstrations of different integration patterns:

1. hello-swift

The basics: calling a Swift function from an Android app. Perfect starting point to understand the integration flow.

2. hello-swift-callback

Shows bidirectional communication—Swift timer callbacks updating the Android UI. Demonstrates how Swift code can drive Android UI updates in real-time.

3. hello-swift-library

Packages Swift code as a reusable Android library component. Ideal for teams building shared modules across projects.

4. native-activity

A complete native Android activity with OpenGL ES rendering written entirely in Swift. Proves Swift can handle graphics-intensive, performance-critical applications on Android.

Swift-Java Interoperability: The Bridge

The swift-java project is crucial to making this all work. It's both a library and a code generator, enabling integration between Swift and Java in both directions by automatically generating safe and performant bindings.

What this means in practice:

  • Call Android APIs (written in Java) from your Swift code
  • Call Swift functions from Java/Kotlin code
  • Automatically generate type-safe bindings instead of manual JNI
  • Choose between FFM (Foreign Function & Memory API) for performance or JNI for compatibility

Want to understand how the bindings work? Check out the recent Swift Server Side meetup talk by Mads Odgaard at this YouTube link.

What You Can (and Can't) Do

What's Included:

  • Swift language and standard library on Android
  • Cross-compilation toolchain for multiple architectures
  • Java/Kotlin interoperability through swift-java
  • Access to Android platform APIs
  • Ability to share business logic across iOS/Android

What's Not Included:

  • SwiftUI (remains exclusive to Apple platforms)
  • Complete UI framework (use Android's UI tools)
  • Drop-in replacement for all Android development

Think of this as bringing Swift's language capabilities and your existing Swift code to Android, not replicating the entire iOS development experience.

What's Next: Vision and Roadmap

The Android workgroup is drafting a vision document, currently under review, for directing future work regarding Swift on Android. This will outline priority areas and guide community efforts.

You can track progress through:

Community Engagement

The Android workgroup encourages you to share your experiences, ideas, tools and apps on the Swift forums. There's an associated discussion thread for this announcement, and you can post in the Android category.

Real-World Use Cases

Who should be excited about this?

iOS developers looking to leverage Swift skills on Android projects without learning Kotlin from scratch.

Cross-platform teams wanting to share business logic, algorithms, and data models between iOS and Android while maintaining native UIs.

Library authors who can now target both major mobile platforms with a single codebase.

The Bottom Line

This is a preview release, which means it's ready for experimentation and early adoption, but probably not production apps just yet. However, the official backing, comprehensive documentation, and growing package ecosystem suggest this is more than just an experiment.


Essential Resources

Top comments (1)

Collapse
 
arshtechpro profile image
ArshTechPro

Write Android applications in Swift
Share code between iOS and Android platforms
Access Android APIs through Swift-Java interoperability
Build native Android binaries using cross-compilation