Get started
Introduction
Installation
Your first app
Tutorials
Fission tutorials
Set up Rust Android GUI development with Fission: SDK, NDK, emulator and phone
Core concepts
Components
State and effects
Protected routes
Server-side rendering
Styling
Testing
Deployment
Reference
API reference
Cookbook
Fission 0.16.0
Documentation version
Read the changelog →

Set up Rust Android GUI development with Fission: SDK, NDK, emulator and phone

Set up the Android SDK, NDK, emulator and phone connection you need to build Rust GUI apps with Fission.
Android

What you will build

Install and verify the Android command-line tools, SDK, NDK, Rust target, emulator and ADB phone connection for a Fission app.
Install the Rust Android target and the SDK, NDK and command-line tools Fission checks
Run Fission's Android doctor and launch the app on an emulator
Connect a phone with ADB and run the app using its authorised device serial
Building an Android app involves two toolchains, not two implementations of the app. Rust compiles the shared code; the Android SDK and NDK provide the host tools, native libraries and packaging needed to run it on a device. An installed Rust target alone does not supply the second half.
We will check those pieces in dependency order, then launch the same app on an emulator or an authorised phone. The distinction is useful when something fails: a missing compiler, an unavailable device and an app error require different corrections.
At the end, fission doctor should find the Android tools and you should be able to launch the app on an emulator or connected phone. The browser preview only shows the example screen. It cannot install SDK packages or connect to a device; the terminal checks are what verify the setup.

Install Android SDK, NDK and emulator packages

Install Android Studio's Android SDK Command-line Tools (latest) package first. Fission currently checks for sdkmanager and avdmanager at cmdline-tools/latest/bin; the newer android sdk command alone does not satisfy those checks yet. Add that directory to PATH, and set ANDROID_HOME to the SDK root if it is not already set.
The generated shell also runs Gradle. Its current Android Gradle Plugin is 8.13.2; Google's compatibility table lists Gradle 8.13 and JDK 17. Use a compatible installation, then check java -version and gradle --version. The script prefers platforms/android/gradlew when you have installed a wrapper there; otherwise gradle must be available on PATH.
The package commands below install API 35 as one explicit example; they are not a Fission-wide version pin. The current generated build script selects the highest installed platform API unless ANDROID_TARGET_API_LEVEL is set, and defaults the minimum API to 24. Inspect platforms/android/README.md and the generated host before changing those choices.
sdkmanager --list | rg 'platform-tools|cmdline-tools|emulator|platforms;android-|build-tools;|ndk;|system-images;android-'
sdkmanager "platform-tools" "emulator" \
  "platforms;android-35" "build-tools;35.0.0" \
  "system-images;android-35;google_apis;arm64-v8a"
sdkmanager --licenses
rustup target add aarch64-linux-android
fission doctor android --project-dir .
Install an NDK side by side through Android Studio's SDK Manager, or choose an exact ndk;... package shown by sdkmanager --list. Fission uses the latest installed NDK under $ANDROID_HOME/ndk unless ANDROID_NDK points to a specific installation. There is no Fission-wide pinned NDK version, so use the version required by your native dependencies rather than copying a version number from another project. Run fission doctor android --project-dir . again after changing the SDK or NDK selection.

Run in an emulator or on a phone

fission devices --project-dir .
fission run --target android --project-dir .
./platforms/android/run-emulator.sh
adb devices -l
fission run --target android --device <adb-serial> --project-dir .
The generated run-emulator.sh creates or starts the configured arm64 AVD, then builds, installs and launches the app. A phone listed as unauthorized has not accepted this computer's debugging key yet: unlock it, accept the prompt and run adb devices -l again. For Wi-Fi debugging, pair the phone in Developer Options and use the serial that ADB reports.
Start from a new project (optional)

Create the project and add the target

Create the project and add Android as a target. This uses Fission's generated host, so you do not need to create a separate Android project by hand.
cargo install cargo-fission
fission init set-up-rust-android-gui-development-with-fission
cd set-up-rust-android-gui-development-with-fission
cargo add serde_yaml
fission add-target android --project-dir .
rustup target add aarch64-linux-android

Files created by Fission

This is the tree created by fission init and fission add-target. Shared Rust code lives in src/; the Android host in platforms/android/ handles launch and packaging.
set-up-rust-android-gui-development-with-fission/
├── Cargo.toml                 # Rust package and dependencies
├── fission.toml               # app identity, targets and capabilities
├── src/
│   ├── main.rs                # generated app entrypoint
│   ├── lib.rs                 # shared app setup
│   ├── app.rs                 # Compose checklist
│   └── translations.rs        # embedded language bundles
└── platforms/
    └── android/              # generated Android host
Keep the screen, shared state, reducers and reusable fission_component! components in the Rust project. Add a separate service or effect module when this app needs that boundary, and give it a name that says what it does. The generated host owns Android launch and packaging, so shared components do not need to import Android APIs.

Run the finished example

fission run --target android --project-dir .

1. Launch a small app with a manual setup checklist

The app gives the build something observable to launch: three labelled checks whose state changes when you select them. Marking a box records your own review of command output; it does not inspect the SDK or convert an unsuccessful diagnostic into success.
Replace the generated src/lib.rs as well as src/app.rs, so the native launcher runs this screen rather than the starter counter. The translations stay separate from the component, and the checklist state belongs to this one interface.
{"id":"fission-tabs-1","tabs":[{"index":0,"label":"src/app.rs","value":"src-app-rs"},{"index":1,"label":"src/lib.rs","value":"src-lib-rs"},{"index":2,"label":"src/translations.rs","value":"src-translations-rs"},{"index":3,"label":"i18n/en-US.yaml","value":"i18n-en-us-yaml"},{"index":4,"label":"i18n/es-ES.yaml","value":"i18n-es-es-yaml"},{"index":5,"label":"preview/lib.rs","value":"preview-lib-rs"}]}
{"id":"fission-tabs-1","index":0,"label":"src/app.rs","value":"src-app-rs"}
use fission::prelude::*;

fission_component! {
    pub ToolchainChecklist<()> {
        state {
            tools_checked: bool = false,
            runtime_checked: bool = false,
            targets_checked: bool = false,
        }
    }
    view(setup, _state, cx) {
        let tokens = &cx.view.env().theme.tokens;
        let reviewed = [setup.tools_checked, setup.runtime_checked, setup.targets_checked]
            .iter().filter(|checked| **checked).count();
    } =>
    Container(SafeArea(child: Scroll(child: Container(
        Column(gap: tokens.spacing.m, children: [
            Text(cx.tr("setup.title")).size(tokens.typography.heading2_size),
            Text(cx.tr("setup.summary")).color(tokens.colors.text_secondary),
            Text(cx.tr("setup.manual")).weight(tokens.typography.font_weight_semibold),
            Divider(),
            Checkbox(
                checked: setup.tools_checked,
                label: Some(cx.tr("setup.tools.check")),
                semantics_identifier: Some("setup.tools".into()),
                bind(on_toggle): to(setup.tools_checked),
            ),
            Text(cx.tr("setup.tools.detail")),
            Checkbox(
                checked: setup.runtime_checked,
                label: Some(cx.tr("setup.runtime.check")),
                semantics_identifier: Some("setup.runtime".into()),
                bind(on_toggle): to(setup.runtime_checked),
            ),
            Text(cx.tr("setup.runtime.detail")),
            Checkbox(
                checked: setup.targets_checked,
                label: Some(cx.tr("setup.targets.check")),
                semantics_identifier: Some("setup.targets".into()),
                bind(on_toggle): to(setup.targets_checked),
            ),
            Text(cx.tr("setup.targets.detail")),
            Divider(),
            Text(cx.tr("setup.reviewed").replace("{count}", &reviewed.to_string())),
            Text(cx.tr("setup.scope")).color(tokens.colors.text_secondary),
        ])
    ).padding_all(tokens.spacing.l)
     .width_length(Length::percent(100.0))
     .max_width(680.0))))
    .height_length(Length::vh(100.0))
}
{"id":"fission-tabs-1","index":1,"label":"src/lib.rs","value":"src-lib-rs"}
mod app;
mod translations;

use fission::prelude::*;

#[cfg(not(any(target_arch = "wasm32", target_os = "android", target_os = "ios")))]
pub fn run_desktop() -> anyhow::Result<()> {
    DesktopApp::<(), _>::new(app::ToolchainChecklist)
        .with_env(translations::create_env())
        .run()
}

#[cfg(any(target_os = "android", target_os = "ios"))]
fn mobile_app() -> MobileApp<(), app::ToolchainChecklist> {
    let app = MobileApp::<(), _>::new(app::ToolchainChecklist)
        .with_env(translations::create_env())
        .with_title("Toolchain checklist");
    #[cfg(target_os = "android")]
    let app = app.with_test_control_port(48761);
    app
}

#[cfg(any(target_os = "android", target_os = "ios"))]
pub fn run_mobile() -> anyhow::Result<()> { mobile_app().run() }

#[cfg(target_os = "android")]
#[no_mangle]
fn android_main(app_handle: AndroidApp) {
    let _ = mobile_app().run_with_android_app(app_handle);
}

#[cfg(target_arch = "wasm32")]
#[wasm_bindgen::prelude::wasm_bindgen(start)]
pub fn run_web() -> Result<(), wasm_bindgen::JsValue> {
    console_error_panic_hook::set_once();
    WebApp::<(), _>::new(app::ToolchainChecklist)
        .with_env(translations::create_env())
        .with_title("Toolchain checklist")
        .run()
        .map_err(|error| wasm_bindgen::JsValue::from_str(&error.to_string()))
}
{"id":"fission-tabs-1","index":2,"label":"src/translations.rs","value":"src-translations-rs"}
use std::collections::HashMap;
use fission::i18n::{Locale, TranslationBundle};
use fission::prelude::*;

pub fn create_env() -> Env {
    let mut env = Env::default();
    env.locale = Locale::from("en-US");
    for (locale, source) in [
        ("en-US", include_str!("../i18n/en-US.yaml")),
        ("es-ES", include_str!("../i18n/es-ES.yaml")),
    ] {
        let messages: HashMap<String, String> =
            serde_yaml::from_str(source).expect("checked-in setup translations");
        env.i18n.add_bundle(TranslationBundle { locale: Locale::from(locale), messages });
    }
    env
}
{"id":"fission-tabs-1","index":3,"label":"i18n/en-US.yaml","value":"i18n-en-us-yaml"}
setup.title: "Android development checklist"
setup.summary: "Keep track of the checks you have run in your own terminal."
setup.manual: "Mark these only after reviewing the command output."
setup.tools.check: "SDK and NDK found"
setup.tools.detail: "Run fission doctor android and review its SDK, NDK and command-line tool checks."
setup.runtime.check: "Emulator or phone available"
setup.runtime.detail: "Use fission devices and adb devices -l; a phone must be authorised."
setup.targets.check: "Rust targets installed"
setup.targets.detail: "Check aarch64-linux-android with rustup target list --installed."
setup.reviewed: "{count} of 3 checks marked"
setup.scope: "This is a manual checklist, not a toolchain diagnostic. Your marks are local to this session; reloading clears them."
{"id":"fission-tabs-1","index":4,"label":"i18n/es-ES.yaml","value":"i18n-es-es-yaml"}
setup.title: "Lista de desarrollo para Android"
setup.summary: "Anota las comprobaciones que has ejecutado en tu propio terminal."
setup.manual: "Marca cada casilla tras revisar la salida del comando."
setup.tools.check: "SDK y NDK encontrados"
setup.tools.detail: "Ejecuta fission doctor android y revisa el SDK, el NDK y las herramientas."
setup.runtime.check: "Emulador o teléfono disponible"
setup.runtime.detail: "Usa fission devices y adb devices -l; el teléfono debe estar autorizado."
setup.targets.check: "Destinos de Rust instalados"
setup.targets.detail: "Comprueba aarch64-linux-android con rustup target list --installed."
setup.reviewed: "{count} de 3 comprobaciones marcadas"
setup.scope: "Esta lista es manual; no diagnostica las herramientas. Las marcas son locales a la sesión y se borran al recargar."
{"id":"fission-tabs-1","index":5,"label":"preview/lib.rs","value":"preview-lib-rs"}
mod app;
mod translations;

use fission::prelude::*;
use wasm_bindgen::prelude::*;

#[wasm_bindgen(start)]
pub fn run() -> Result<(), JsValue> {
    console_error_panic_hook::set_once();
    WebApp::<(), _>::new(app::ToolchainChecklist)
        .with_env(translations::create_env())
        .with_title("Toolchain checklist")
        .mount("#fission-web-mount")
        .run()
        .map_err(|error| JsValue::from_str(&error.to_string()))
}
{"id":"fission-tabs-1"}
Select and clear each checklist item, then reload. The marked count must follow the actual choices and reset on reload. On Android, repeat the same interaction after launching the generated app; the browser cannot establish that native launch works.
Show the app preview
Hide the app preview

2. Verify the Android toolchain

The browser preview does not inspect your machine. In the project root, run fission doctor first; it names missing SDK, NDK or Rust prerequisites. Then list the launchable targets and run the generated AVD script:
fission doctor android --project-dir .
fission devices --project-dir .
./platforms/android/run-emulator.sh
The launcher creates or starts the configured arm64 AVD, then builds, installs and launches the app. If you are using a phone instead, connect it and follow the device-specific commands in the setup section above. fission test is a generated host smoke test; cargo test only runs tests you have added to the project.
For a connected Android phone, enable USB debugging or pair Wireless debugging, unlock it and accept the host-key prompt. Then verify and run the selected serial:
adb devices -l
fission run --target android --device <adb-serial> --project-dir .
A serial shown as unauthorized means the phone has not accepted the host key. A serial shown as offline usually means ADB must reconnect or the device must finish starting. Revoke USB debugging authorisations in Developer Options only if the prompt does not reappear after reconnecting.

Current references

These references explain the API contract behind the example and the target-specific behavior to verify: