rust-android-jni
CommunitySafe Android JNI patterns for Rust code.
System Documentation
What problem does it solve?
Android JNI integrations with Rust are error-prone due to thread lifecycles, local references, and marshaling choices. This skill consolidates canonical patterns to ensure safe, predictable interactions between Rust and Java/Kotlin on Android; it emphasizes panic containment, AttachCurrentThread/DetachCurrentThread discipline, local-ref frame management, JNIEnv lifetime across awaits, and efficient data marshaling for hot paths.
Core Features & Use Cases
- Panic containment: ensure panics do not unwind across JNI boundaries.
- Thread lifecycle discipline: enforce AttachCurrentThread/DetachCurrentThread usage for non-JVM Rust threads.
- Local reference safety: apply frame-based local-reference handling to avoid JniLocalReferenceTableOverflow.
- Async safety: prohibit crossing JNIEnv across await boundaries; use separate tasks with proper JNI attachment.
- Performance-focused marshaling: prefer DirectByteBuffer over JByteArray copies for hot-path data.
- Use cases include authoring or reviewing JNI exports across ripdpi-android, ripdpi-tunnel-android, ripdpi-warp-android, ripdpi-relay-android, or any JNI export in the project.
Quick Start
Follow the five canonical rules when creating or updating any JNI export to ensure safe, deterministic Java-Rust interactions.
Dependency Matrix
Required Modules
None requiredComponents
Standard package💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: rust-android-jni Download link: https://github.com/po4yka/RIPDPI/archive/main.zip#rust-android-jni Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 510,000+ vetted skills library on demand.