SpruceID
Search…
Java and Android
both Java and Android developers access DIDKit through the Java bindings

At a Glance

  • DIDKit exposes a straightforward set of Java bindings, using the Java Native Interface (JNI).
  • The JAR file includes all of DIDKit's Java class files. To use this in an application, you must also include the shared library (libdidkit.so) in your application in the Java library path.
  • For a quick function & type reference, you can study the DIDKitTest.java file.
  • All the low-level calls that the Rust library exposes to JNI are documented in the JNI section of the Rust documentation.

Installation

Install Rust and DIDKit as usual and then:

Build

Run:
# from DIDKit root directory:
make -C lib ../target/didkit.jar
To build the shared library for your current platform/architecture:
# from DIDKit root directory:
make -C lib ../target/release/libdidkit.so

Test

# from DIDKit root directory:
make -C lib ../target/tests/java.stamp

+ Android

For Android, build the separate Android library (AAR file) which includes the Java class files and shared libraries for all Android targets.

Android

​Android Library (AAR file) for DIDKit. The AAR file includes Java class files using JNI, and binary shared libraries for Android's supported architectures (x86, armeabi-v7a, arm64-v8a, x86_64). The AAR can be added to existing Android projects using Android Studio or Gradle.

Requires

Android SDK and NDK for Linux x86_64. The Android SDK is expected to be installed at ~/Android/Sdk. If it is somewhere else instead, you can specify it with a Make variable, e.g. make ANDROID_SDK_ROOT=/other/location/android-sdk.
Rust Android targets are also required. To install those with rustup, run:
//from root directory of didkit project
make -C lib install-rustup-androidCopy

Build

//from root directory of didkit project
make -C lib ../target/test/aar.stampCopy
Make variables
  • ANDROID_SDK_ROOT - path to Android SDK. Default: ~/Android/Sdk
  • ANDROID_TOOLS - Android tools directory. Default is to pick one matching $(ANDROID_SDK_ROOT)/build-tools/*.
  • ANDROID_NDK_HOME - Android NDK directory. Default is $(ANDROID_SDK_ROOT)/ndk-bundle) if exists, or one matching $(ANDROID_SDK_ROOT)/ndk/*.

Examples

Tool
Example
Authentication, Tomcat, CHAPI
​Github​
Authentication, Maven, MySQL, Redis
​Github​
Last modified 22d ago