Android (Kotlin) bindings for Iroh blob storage. Parallel to iroh-swift/:
same Rust core (iroh 0.98 / iroh-blobs 0.100), different FFI strategy.
| Layer | iroh-swift | iroh-android |
|---|---|---|
| Surface | Swift actor IrohNode |
Kotlin class IrohNode |
| FFI mechanism | C ABI + callbacks | JNI (jni-rs) + blocking |
| Async bridge | CheckedContinuation |
withContext(Dispatchers.IO) |
| Packaging | XCFramework | AAR |
val node = IrohNode.create(
storagePath = "/data/data/com.example/iroh",
relayEnabled = true,
customRelayUrl = null,
)
try {
val ticket = node.put(bytes) // suspend → String
val out = node.get(ticket) // suspend → ByteArray
} finally {
node.close()
}Errors surface as IrohException (sealed: NodeUnavailable, PublishFailed,
FetchFailed, TicketInvalid).
Requires Android NDK (r25+) and the three Android Rust targets.
./scripts/install-targets.sh # rustup target add aarch64/armv7/x86_64-linux-android
./scripts/build-aar.sh # cross-compile .so + bundle AAR
# → kotlin/build/outputs/aar/iroh-android-release.aarThe script auto-detects NDK in this order:
$ANDROID_NDK_HOME$ANDROID_HOME/ndk/<latest>$HOME/Library/Android/sdk/ndk/<latest>
Tagged releases are published to GitHub Packages by .github/workflows/release.yml.
The published AAR bundles libiroh_android.so for arm64-v8a, armeabi-v7a,
and x86_64.
In the consumer's settings.gradle.kts:
dependencyResolutionManagement {
repositories {
google()
mavenCentral()
maven {
name = "GitHubPackagesIrohAndroid"
url = uri("https://maven.pkg.github.com/arkavo-org/iroh-android")
credentials {
username = providers.gradleProperty("gpr.user").orNull
?: System.getenv("GITHUB_ACTOR")
password = providers.gradleProperty("gpr.token").orNull
?: System.getenv("GITHUB_TOKEN")
}
}
}
}In the consumer's version catalog:
iroh-android = { module = "net.arkavo:iroh-android", version = "0.1.0" }GitHub Packages requires authentication even for public packages. Local
developers need a personal access token with read:packages scope, exposed
as GITHUB_TOKEN (or set gpr.user / gpr.token in ~/.gradle/gradle.properties).
CI uses the workflow's built-in GITHUB_TOKEN.
For local iteration across both repos, you can still composite-include this
project in the consumer's settings.gradle.kts to shadow the published artifact.
- Bump
VERSION(root) andrust/Cargo.tomlpackage.version. - Commit, then tag:
git tag v0.1.1 && git push --tags. - The
Releaseworkflow cross-compiles the Rust cdylib, assembles the AAR, publishes to GitHub Packages, and attaches the AAR to the GitHub Release.
Dual licensed under MIT and Apache 2.0.