Get the latest tech news

Injecting Java from native libraries on Android


3 August 2025 When you're writing Rust and you want cross-platform support, Android is uniquely peculiar. Many OS functions that we take for granted when developing on desktop platforms are more complicated to access.

If your code is purely computation or it's using std to do basic things like open a TCP socket or write to a file then this tends to work. If you're working under this perspective, either Rust on Android is limited to doing things that don't require callbacks or you have to ensure that the classes you need already exist in the JVM. If your Rust code wants to support Android but it needs some Java to do its job then it can bring that along in a self-contained manner and inject it and the person who included your library doesn't have to worry about a thing beyond editing Cargo.toml.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of Android

Android

Photo of Java

Java

Photo of native libraries

native libraries

Related news:

News photo

This USB-C accessory gave my Android and iPhone thermal imaging powers - and it's on sale

News photo

I replaced my Pixel 9 Pro with this $700 Android phone for weeks - and didn't regret it

News photo

How to clear your Android phone cache (and why it's the easiest way to speed it up)