A guide for building and integrating Rust libraries into iOS and Android mobile applications.
Geal/rust_on_mobile is a practical guide and example project for embedding Rust code in mobile applications. It provides step-by-step instructions for cross-compiling a Rust library to work on both iOS (via CocoaPods) and Android (via JNI), addressing challenges like multi-architecture support and platform-specific integration.
Mobile developers (iOS and Android) who want to integrate Rust libraries into their apps for performance-critical or safety-sensitive components, and Rust developers looking to deploy their code to mobile platforms.
It offers concrete, tested examples and scripts for automating the build and linking process, reducing the friction of combining Rust with mobile toolchains. Unlike generic tutorials, it tackles real-world issues like CocoaPods packaging, JNI binding creation, and cross-compilation for multiple architectures.
This project provides a comprehensive walkthrough for embedding Rust code in mobile applications, covering both iOS (via CocoaPods) and Android (via JNI). It addresses the practical challenges of cross-compilation, library packaging, and platform-specific integration.
The project emphasizes practical, step-by-step guidance for developers who want to leverage Rust's performance and safety in mobile environments, while navigating the complexities of cross-platform native integration.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Enables a single Rust codebase for both iOS and Android, as demonstrated with steps for cross-compilation and multi-architecture support, reducing logic duplication.
Provides detailed instructions for creating a CocoaPod, including podspec adjustments and linting, which simplifies integration into iOS projects.
Offers concrete examples for setting up JNI functions, configuring cargo for Android targets, and placing libraries in jniLibs directories.
Uses tools like cargo-lipo for iOS universal binaries and NDK for Android, supporting various architectures with provided scripts and configs.
Requires extensive manual steps for CocoaPods, JNI writing, and build hacks; the README admits 'ugly hack' for linking and fighting CocoaPods issues.
Faces unresolved issues like bitcode format mismatches with Apple's LLVM and exception unwinding conflicts, necessitating workarounds or compromises.
JNI functions are written manually with no built-in generation, and the guide notes potential changes in NDK paths, indicating maintenance gaps.