Get started
Introduction
Installation
Your first app
Tutorials
Fission tutorials
Integrate an Android SDK through a Fission native module
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 →

Integrate an Android SDK through a Fission native module

Add AndroidX ExifInterface and a Java orientation reader through native module build inputs. Keep dependency wiring separate from the missing Java-to-Rust call bridge.
Android

What you will build

Configure a real Android library and Java helper without moving Android dependencies into shared UI or pretending the runtime bridge already exists.
Declare the Google Maven repository and the exact ExifInterface dependency
Add the orientation reader's Java source directory to the generated host build
Read image orientation through the real AndroidX InputStream API
Identify the separate typed runtime bridge and off-UI-thread call needed to use that helper
An Android SDK has two different integration boundaries. Gradle must resolve and package its dependency, then application code needs a way to call it and receive a result. A successful build establishes the first boundary; it does not create the second one automatically.
Here, we add AndroidX ExifInterface and compile a small Java helper that reads an image's orientation metadata. This is a concrete build-input example, not a new Fission image API. Calling the helper from Rust, acquiring an allowed image stream and returning its result through an asynchronous effect remain separate runtime work.
The interactive screen records the build checks you performed. It does not display a fabricated photo, work order or SDK response.
Start from a new project (optional)

Create the Android project

Complete Android SDK/NDK setup and prepare an emulator or a phone for the eventual installed app.
cargo install cargo-fission
fission init android-integrate-an-android-sdk-through-a-fission-native-module
cd android-integrate-an-android-sdk-through-a-fission-native-module
cargo add serde_yaml
fission add-target android --project-dir .
Keep the generated src/main.rs. The replacement shared library selects the review screen for native and Web targets rather than leaving the starter counter on Android.

Run the finished example

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

1. Keep build evidence separate from runtime output

The review owns three local values: two explicitly self-reported checks and a note. It is deliberately not a progress detector. Neither checking a box nor rendering this app says anything about Gradle, signing, image metadata or the Java-to-Rust bridge.
{"id":"fission-tabs-1","tabs":[{"index":0,"label":"src/app.rs","value":"src-app-rs"},{"index":1,"label":"src/translations.rs","value":"src-translations-rs"},{"index":2,"label":"i18n/en-US.yaml","value":"i18n-en-us-yaml"},{"index":3,"label":"i18n/es-ES.yaml","value":"i18n-es-es-yaml"},{"index":4,"label":"src/lib.rs","value":"src-lib-rs"},{"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 IntegrationReview<()> {
        state {
            dependency_resolved: bool = false,
            java_compiled: bool = false,
            notes: String = String::new(),
        }
    }
    view(review, _state, cx) {
        let tokens = &cx.view.env().theme.tokens;
    } =>
    SafeArea(
        child: Scroll(
            child: Container(
                child: Column(gap: tokens.spacing.m, children: [
                    Text(cx.tr("integration.title")).size(tokens.typography.heading2_size),
                    Text(cx.tr("integration.context")),
                    Code(text: "androidx.exifinterface:exifinterface:1.4.2".to_string()),
                    Checkbox(
                        label: Some(cx.tr("integration.resolved")),
                        checked: review.dependency_resolved,
                        bind(on_toggle): to(review.dependency_resolved),
                    ),
                    Checkbox(
                        label: Some(cx.tr("integration.compiled")),
                        checked: review.java_compiled,
                        bind(on_toggle): to(review.java_compiled),
                    ),
                    TextInput(
                        label: Some(cx.tr("integration.notes").into()),
                        helper_text: Some(cx.tr("integration.notes_help").into()),
                        multiline: true,
                        bind: review.notes,
                        semantics_identifier: "integration.notes".to_string(),
                    ),
                    Text(cx.tr(if review.dependency_resolved && review.java_compiled {
                        "integration.recorded"
                    } else {
                        "integration.incomplete"
                    })),
                    Text(cx.tr("integration.bridge_gap")),
                ]),
            ).padding_all(tokens.spacing.l),
        ),
    )
}
{"id":"fission-tabs-1","index":1,"label":"src/translations.rs","value":"src-translations-rs"}
use std::collections::HashMap;
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("valid checked-in translations");
        env.i18n.add_bundle(TranslationBundle { locale: Locale::from(locale), messages });
    }
    env
}
{"id":"fission-tabs-1","index":2,"label":"i18n/en-US.yaml","value":"i18n-en-us-yaml"}
integration.title: "Review the Android SDK integration"
integration.context: "Record the results you observed in your own build. This screen does not inspect Gradle or call the SDK."
integration.resolved: "I checked that Gradle resolved this dependency."
integration.compiled: "I checked that the Java helper compiled in the Android build."
integration.notes: "Build evidence and next steps"
integration.notes_help: "Record the command and a non-sensitive summary. Do not paste credentials, private repository tokens or customer image metadata."
integration.recorded: "Both build checks are recorded. This is your report, not automated qualification."
integration.incomplete: "Complete the build checks before recording them here."
integration.bridge_gap: "Calling the SDK from Rust still needs a platform bridge and runtime tests. These checkboxes do not establish that."
{"id":"fission-tabs-1","index":3,"label":"i18n/es-ES.yaml","value":"i18n-es-es-yaml"}
integration.title: "Revisar la integración del SDK Android"
integration.context: "Registra lo que observaste en tu propia compilación. Esta pantalla no inspecciona Gradle ni llama al SDK."
integration.resolved: "Comprobé que Gradle resolvió esta dependencia."
integration.compiled: "Comprobé que el helper Java compiló en la aplicación Android."
integration.notes: "Evidencia de compilación y próximos pasos"
integration.notes_help: "Anota el comando y un resumen no sensible. No pegues credenciales, tokens de repositorios privados ni metadatos de clientes."
integration.recorded: "Se registraron ambas comprobaciones. Es tu informe, no una validación automática."
integration.incomplete: "Completa las comprobaciones antes de registrarlas aquí."
integration.bridge_gap: "Llamar al SDK desde Rust aún requiere un puente de plataforma y pruebas de ejecución. Estas casillas no lo demuestran."
{"id":"fission-tabs-1","index":4,"label":"src/lib.rs","value":"src-lib-rs"}
pub mod app;
mod translations;

use app::IntegrationReview;
use fission::prelude::*;

#[cfg(not(any(target_arch = "wasm32", target_os = "android", target_os = "ios")))]
pub fn run_desktop() -> anyhow::Result<()> {
    DesktopApp::<(), _>::new(IntegrationReview::new())
        .with_env(translations::create_env())
        .run()
}
#[cfg(any(target_os = "android", target_os = "ios"))]
fn mobile_app() -> MobileApp<(), IntegrationReview> {
    let app = MobileApp::<(), _>::new(IntegrationReview::new())
        .with_env(translations::create_env());
    #[cfg(all(target_os = "android", debug_assertions))]
    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(IntegrationReview::new())
        .with_env(translations::create_env())
        .run()
        .map_err(|error| wasm_bindgen::JsValue::from_str(&error.to_string()))
}
{"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::IntegrationReview::new())
        .with_env(translations::create_env())
        .mount("#fission-web-mount")
        .run()
        .map_err(|error| JsValue::from_str(&error.to_string()))
}
{"id":"fission-tabs-1"}
Enter a note about the dependency you intend to add. Leave the checks clear until you have actual build evidence. The values last only for this screen's lifetime and are not saved to disk.
Show the app preview
Hide the app preview

2. Declare a real dependency and a small Java boundary

This example adds one Android-only library to the tutorial app: androidx.exifinterface:exifinterface:1.4.2. The coordinate and Google Maven repository are documented in the official AndroidX ExifInterface release instructions. Pinning it here makes the example reviewable; it is not an instruction to use a dynamic “latest” version.
Append this module to the existing fission.toml. Do not replace the app's identity, targets or other configuration with this fragment.
[[native.modules]]
name = "photo-metadata"

[native.modules.android]
repositories = ["google()"]
gradle_dependencies = ["androidx.exifinterface:exifinterface:1.4.2"]
source_dirs = ["native/android/photo/src/main/java"]
Fission places the dependency in the generated Gradle build and adds the declared directory as Java source. Keep handwritten source outside platforms/android/, which is generated. The native-module declaration does not enable a Kotlin plugin, create a JNI bridge or grant access to a user's photos.
{"id":"fission-tabs-1","tabs":[{"index":0,"label":"native/android/photo/src/main/java/org/example/photo/PhotoOrientationReader.java","value":"native-android-photo-src-main-java-org-example-photo-photoorientationreader-java"}]}
{"id":"fission-tabs-1","index":0,"label":"native/android/photo/src/main/java/org/example/photo/PhotoOrientationReader.java","value":"native-android-photo-src-main-java-org-example-photo-photoorientationreader-java"}
package org.example.photo;

import androidx.exifinterface.media.ExifInterface;
import java.io.IOException;
import java.io.InputStream;

public final class PhotoOrientationReader {
    private PhotoOrientationReader() {}

    // The caller owns the stream and closes it. Call this off the UI thread.
    public static int readOrientation(InputStream image) throws IOException {
        ExifInterface metadata = new ExifInterface(image);
        return metadata.getAttributeInt(
                ExifInterface.TAG_ORIENTATION,
                ExifInterface.ORIENTATION_UNDEFINED);
    }
}
{"id":"fission-tabs-1"}
The helper accepts an already-open stream rather than inventing a path it may not be allowed to read. The caller owns its lifetime. The ExifInterface API reference defines the constructor and orientation lookup; a missing orientation returns the explicit undefined value. Do not silently turn missing metadata into a claim that an image is correctly oriented.
Image parsing can perform I/O and fail. A later bridge must call it off the UI thread, propagate the error and return only the typed result needed by the app. Never pass a live component, GlobalState reference or reducer context into a background Java task.
The interactive review is unchanged because adding a build dependency is not a new UI result. The Java helper must compile in the Android build before you record the corresponding check. It is not yet callable by the Rust screen.
Show the app preview
Hide the app preview

3. Check generated inputs and distinguish the remaining bridge

Build the real target, then inspect what Fission generated:
fission doctor android --project-dir .
fission build --target android --project-dir .
sed -n '1,160p' platforms/android/native-modules.gradle
sed -n '1,160p' platforms/android/settings.gradle.kts
fission run --target android --project-dir .
fission test --target android --project-dir .
The generated dependency block should name the pinned coordinate, and the Java source set should reference the declared project-relative source directory. A successful Android build compiles the helper against that SDK. Record the command and a non-sensitive summary in the review screen; do not paste private Maven credentials or customer image metadata.
To use the helper in the app, an Android-specific bridge still needs to accept an authorised image stream, invoke the SDK asynchronously, and map its success or failure into a typed Fission result. That bridge is not generated by native.modules and is not implemented in this build-wiring lesson. Keep shared UI and product state independent of the Java SDK.
The native module guide explains this boundary, and the Android package guide lists the target configuration. Do not interpret a packaged dependency as a completed end-to-end feature.
The completed scope here is a declared Android dependency and handwritten Java source in the generated build. Runtime invocation, error propagation and physical image tests remain separate, explicitly unimplemented work.

Current references