- A developer recently shared their successful experience in building an Android app using Rust and the Iced GUI library, updating the example to the latest releases of Iced and WGPU.
- This initiative aims to draw more attention to Rust's capabilities on Android, leveraging foundational tools like android-activity, winit, and wgpu.
- Starting with existing examples from the rust-android-examples repository, which support both NativeActivity and GameActivity, the developer combined these with Iced's integration example for WGPU applications.Despite Iced's primary focus on desktop and web—where mobile support is not an explicit goal—the integration compiled with minimal errors.
- Key challenges included fixing text rendering by loading fonts via a specific method and patching widgets for touch support.
Quick Summary
A developer recently shared their successful experience in building an Android app using Rust and the Iced GUI library, updating the example to the latest releases of Iced and WGPU. This initiative aims to draw more attention to Rust's capabilities on Android, leveraging foundational tools like android-activity, winit, and wgpu. Starting with existing examples from the rust-android-examples repository, which support both NativeActivity and GameActivity, the developer combined these with Iced's integration example for WGPU applications.
Despite Iced's primary focus on desktop and web—where mobile support is not an explicit goal—the integration compiled with minimal errors. Key challenges included fixing text rendering by loading fonts via a specific method and patching widgets for touch support. The result is a working example that builds on prior community efforts. Other Rust-based options for Android include libraries like xilem and egui, as well as game engines such as Fyrox and Bevy. Looking ahead, similar approaches could extend to iOS, with no major blockers identified.
Foundational Tools for Rust on Android
The journey to building Android apps with Rust begins with essential crates and tools that form the backbone of native development. Developers can rely on android-activity to handle Android's activity lifecycle, integrating seamlessly with winit for window management and wgpu for graphics rendering. These components provide a solid foundation without needing additional frameworks initially.
Existing resources play a crucial role in getting started. The rust-android-examples repository offers a comprehensive set of demonstrations using both NativeActivity and GameActivity, allowing developers to test basic setups quickly. Additionally, examples incorporating egui are available within this repo, showcasing immediate UI possibilities on Android.
Gratitude extends to the contributors behind these tools, including projects like jni-rs for Java Native Interface bindings and various others that enable Rust's interoperability with Android's ecosystem. This collaborative effort underscores the community's commitment to expanding Rust's mobile footprint.
- android-activity: Manages Android app activities in Rust.
- winit: Provides cross-platform window handling.
- wgpu: Delivers WebGPU-based graphics API support.
- rust-android-examples: Includes practical demos for NativeActivity and GameActivity.
I'd like to share my experience to attract more attention to Rust on Android.— Developer
Integrating Iced for GUI Development
Iced, a cross-platform GUI library primarily designed for desktop and web applications, presents unique opportunities for Android despite mobile not being an explicit goal. Developers have experimented with its integration, as documented in community discussions, revealing pathways to adapt it for touch-based interfaces.
The integration process leverages Iced's example for embedding within wgpu applications. By combining this with android-activity, compilation proceeds smoothly with few errors, enabling a functional GUI layer on top of the core rendering setup.
Key Integration Steps
To achieve this, the basic stack of android-activity, winit, and wgpu serves as the entry point. The Iced integration example then overlays the GUI elements, allowing Rust code to drive both the app logic and user interface.
- Start with rust-android-examples to verify the base Android setup.
- Incorporate the Iced WGPU integration example.
- Compile and test for compatibility on Android devices.
This approach transforms Iced from a desktop-focused tool into a viable option for mobile, building directly on established Rust graphics primitives.
Overcoming Challenges in Implementation
While the integration of Iced with Android proved straightforward in many aspects, certain hurdles required targeted solutions. A primary issue was the absence of text rendering, which stemmed from font loading mechanisms not optimized for mobile environments.
This was resolved by adopting a font loading technique demonstrated in community resources, ensuring proper display of textual elements within the app. Following this, modifications to select widgets introduced essential touch support, adapting the interface for Android's input methods.
The developer's contribution focused on synthesizing these elements into a cohesive, working example rather than pioneering new features. This assembly of prior work— from font fixes to touch patches—results in a reproducible template for others exploring Rust on Android.
- Text rendering fix: Implemented via specific font loading method.
- Touch support: Added through widget patches.
- Overall role: Combining existing solutions into a functional demo.
These adjustments highlight the iterative nature of porting desktop libraries to mobile, where small tweaks unlock broader usability.
Alternatives and Future Directions 🚀
Beyond Iced, several Rust-based options facilitate Android app development. Xilem explicitly targets mobile support as a core objective, while egui already accommodates touch interfaces natively. Game engines like Fyrox and Bevy extend their capabilities to mobile platforms, leveraging winit and wgpu for rendering.
Any project built atop these foundational elements can potentially target Android using NativeActivity or GameActivity approaches. Webview-based apps, though outside this discussion, represent another avenue not explored here.
Extending to iOS
Prospects for iOS mirror Android's setup, potentially even simpler in execution. The strategy involves selecting winit, wgpu, and the Iced integration example, then refining as needed—such as the font loading trick—with no apparent obstacles.
Future efforts will prioritize this expansion once time permits, promising cross-platform consistency in Rust mobile development.
In conclusion, the successful Rust and Iced Android app exemplifies the language's maturing ecosystem for mobile. By honoring community tools and addressing integration nuances, developers can innovate efficiently. This progress invites more experimentation, fostering Rust's role in diverse app creation across platforms.
"My role here was to take all the prior work and combine it together in a way that there's a working example."
— Developer
"Once again, thanks to all the people who made it possible and I wish you have a great time building mobile apps with Rust!"
— Developer
Frequently Asked Questions
How can developers start building Android apps with Rust?
Begin with the rust-android-examples repository, using android-activity, winit, and wgpu for a basic native setup supporting NativeActivity and GameActivity.
Is Iced suitable for mobile development despite its focus?
While mobile is not an explicit goal for Iced, integration with WGPU applications works on Android after addressing text rendering and touch support.
What are other Rust tools for Android apps?
Options include xilem for mobile goals, egui for UI, and game engines like Fyrox and Bevy, all built on winit and wgpu.

