To integrate libsodium into your Android application, you need:
- The libsodium library compiled for your Android platform.
- JNI binding e.g. kalium-jni
If you trust random people on the Internet (which you shouldn't!), Download this tarball and extract it to your project source. Otherwise, follow the instructions below to compile them yourself.
libsodium
You need a Linux / VM box with Android NDK to compile the libsodium shared libraries, and you think you need the current git branch to compile it with the NDK. After you have verified this, compile the Android library code for ARM, ARMv7, and x86:
./autogen.sh ./dist-build/android-arm.sh
potassium-jni
To compile potassium, you need SWIG . Then you need to generate the SWIG C shell, compile your own libkaliumjni code for your target platform (s), install it in the libs / application directory, and enable the JAR.
In the kalium-jni / jni subdirectory, create a SWIG shell and your own libkaliumjni.so for your host (you will need it for testing the JAR):
./compile.sh
Then change jni/Android.mk and replace /installs/ with the one where you compiled libsodium and $(TARGET_ARCH) with $(TARGET_ARCH_ABI) , then run kalium-jni in the directory:
ndk-build APP_ABI=armeabi,armeabi-v7a,x86 [...] [x86] Install : libkaliumjni.so => libs/x86/libkaliumjni.so [armeabi] Install : libkaliumjni.so => libs/armeabi/libkaliumjni.so [armeabi-v7a] Install : libkaliumjni.so => libs/armeabi-v7a/libkaliumjni.so
The libs/ directory now contains its own kalium libraries. Copy it into your Android project.
Finally, you need to compile the callium JAR:
mvn clean install
It should be in ~/.m2/repository/org/abstractj/kalium/kalium-jni/1.0.0-SNAPSHOT/kalium-jni-1.0.0-SNAPSHOT.jar . Copy it to the libs directory. It is accompanied by javadoc and JAR sources, which you can add to Eclipse for links.