18 releases (4 breaking)
|Oct 4, 2023
|Jun 5, 2023
|Mar 16, 2023
|Dec 28, 2022
#364 in Cargo plugins
498 downloads per month
Contains (JAR file, 60KB) gradle-wrapper.jar
❗⚠️ WARNING - DEPRECATION NOTICE ❗⚠️
THIS CRATE HAS BEEN DEPRECATED, AND HAS BEEN RENAMED TO
The answer to "how do I use Rust on iOS and Android?"
cargo-mobile takes care of generating Xcode and Android Studio project files, building and running on device, generating project boilerplate, and a few other things!
In the meantime, tauri-mobile contains the template of wry, please follow wry's instruction if you want to use with it.
The build will probably take a bit, so feel free to go get a snack or something.
cargo install --git https://github.com/tauri-apps/tauri-mobile
tauri-mobile is currently supported on macOS, Linux and Windows. Note that it's not possible to target iOS on platforms other than macOS! You'll still get to target Android either way.
You'll need to have Xcode and the Android SDK/NDK installed. Some of this will ideally be automated in the future, or at least we'll provide a helpful guide and diagnostics.
Whenever you want to update:
cargo mobile update
To start a new project, all you need to do is make a directory with a cute name,
cd into it, and then run this command:
cargo mobile init
After some straightforward prompts, you'll be asked to select a template pack. Template packs are used to generate project boilerplate, i.e. using the
wry template pack gives you a wry project that runs out-of-the-box on desktop and mobile.
|Minimal wry project
|Full egui + winit + wgpu example based on agdk-egui example
Template pack contribution is welcomed
For all the templates available now, currently
bevytemplates do not work and will encounter compile error if you try to build the project.
Once you've generated your project, you can run
cargo run as usual to run your app on desktop. However, now you can also do
cargo apple run and
cargo android run to run on connected iOS and Android devices respectively!
If you prefer to work in the usual IDEs, you can use
cargo apple open and
cargo android open to open your project in Xcode and Android Studio respectively.
For more commands, run
cargo apple, or
cargo android to see help information.
cargo android run will build, install and run the app and follows device logs emitted by the app.
By default, warn and error logs are displayed. Additional logging of increasing verbosity can be shown by use of the
-vv options. These also provide more verbose logging for the build and install steps.
For fine-grained control of logging, use the
-f) option, which takes an Android log level, such as
debug. This option overrides
the default device logging level set by
If using the
android_logger crate to handle Rust log messages,
trace logs from Rust are mapped to
verbose logs in Android.