When Every Zstandard Library Failed on Android, I Built My Own

작성자

카테고리:

← 피드로
DEV Community · Mbuodile Obiosio · 2026-07-22 개발(SW)

Mbuodile Obiosio

Meet unzstd – a pure Java Zstandard (zstd) decoder for Android and the JVM.

What looked like a simple dependency turned into a surprisingly difficult problem.

I needed to decompress zstd-compressed datasets in an Android app. Existing options all had major trade-offs:

  • aircompressor 2.x depends on “sun.misc.Unsafe”, which crashes on Android ART.
  • aircompressor 3.x moved to “java.lang.foreign”, which Android doesn’t support.
  • zstd-jni works well, but requires native “.so” files, ABI-specific packaging, and brings additional complexity with newer Android memory page requirements.

I had to build a pure Java alternative so I ported aircompressor’s decoder

The result:

✅ No native code
✅ No “Unsafe”
✅ No “java.lang.foreign”
✅ Android API 26+
✅ JVM 9+
✅ Zero “Unsafe” references in the compiled bytecode (verified)

To make sure it was actually correct, I differentially tested it against libzstd across compression levels 1-22, covering one-shot decompression, streaming, fuzzing, and corruption-boundary tests.

It’s decode-only, Apache 2.0 licensed, and completely open source.

If you’re building Android or Java applications that consume zstd-compressed data, I hope this saves you a few days of debugging.

implementation(“com.qyntrax:unzstd:0.1.0”)

GitHub: https://github.com/mbobiosio/unzstd

Feedback, bug reports, and contributions are always welcome.

Android #Java #Kotlin #OpenSource #JVM #Zstd #Compression

원문에서 계속 ↗

코멘트

답글 남기기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다