Skip to content


Repository files navigation


Build Status

A minimal JNI wrapper over libsodium. This is now deprecated. Kalium-JNI (now called libsodium-jni) seems to have come up with a similar design to this repository with regards to function exports. Since libsodium-jni has both addressed my original complaints and is actively maintained (at least more than this repository), I would advise using it instead.

Other Java Options For Libsodium

What's the difference?

Kalium is a very sensible Java wrapper over libsodium that depends on jnr-ffi. Kalium takes an OOP approach whereas Sodium-JNI provides a completely static API, and attempts to use Java primatives over library defined classes.

Kalium-JNI mimics the Kalium API, but wraps libsodium using SWIG and the JNI. Sodium-JNI exports more functions (sodium_init, etc.) and doesn't attempt to provide an OOP wrapper. Sodium-JNI started as a fork of Kalium-JNI, but has diverged significantly in both the build process and wrapper API.

Building Requirements

  • SWIG
  • Android SDK + Android NDK
  • Autotools (for building libsodium at the moment)
  • set JAVA_HOME, ANDROID_HOME and ANDROID_NDK_HOME environment variables


Make sure you clone this repo with the --recursive flag set, it depends on libsodium as a submodule at the moment.

Run and a folder sodiumjni-androidlib will be generated with the debug and release version of the .aar

The local .aar can be included in an Android studio project


  • View issues to see what's being worked on.


Libsodium for Android 4.3+







No releases published


No packages published