Module slint::android

source ·
Expand description

Android backend.

Note: This module is only available on Android with the “backend-android-activity-05” feature

Slint uses the android-activity crate as a backend.

For convenience, Slint re-exports the content of the android-activity under slint::android::android_activity.

As with every application using the android-activity crate, the entry point to your app will be the android_main function. From that function, you can call slint::android::init or slint::android::init_with_event_listener


This is a basic example of an Android application. Do not forget the #[no_mangle]

fn android_main(app: slint::android::AndroidApp) {

    // ... rest of your code ...
        export component MainWindow inherits Window {
            Text { text: "Hello World"; }

That function must be in a cdylib library, and you should enable the “backend-android-activity-05”` feature of the slint crate in your Cargo.toml:

crate-type = ["cdylib"]

slint = { version = "1.5", features = ["backend-android-activity-05"] }

§Building and Deploying

To build and deploy your application, we suggest the usage of cargo-apk, a cargo subcommand that allows you to build, sign, and deploy Android APKs made in Rust.

You can install it and use it with the following command:

cargo install cargo-apk
cargo apk run --target aarch64-linux-android --lib

Please ensure that you have the Android NDK and SDK installed and properly set up in your development environment for the above command to work as expected. For detailed instructions on how to set up the Android NDK and SDK, please refer to the Android Developer’s guide. The ANDROID_HOME and ANDROID_NDK_ROOT environment variable need to be set to the right path.

Note Slint does not require a specific build tool and can work with others, such as xbuild.


  • pub use android_activity::AndroidApp;