This document gives the instruction for installing the Blockchain Commons Libwally Java library.
We add utility script for installing all system dependencies, you can find it at
<android|java>/scripts/install_deps.shIf you want to do it manually by yourself, make sure all of following dependencies are installed correctly.
- Adopt Open JDK 1.8 is recommended for both MacOS and Linux.
- Android NDK r19c (Linux and Mac) or above is recommended for building Android library.
Well tested on Ubuntu 16.04, 18.04 and Debian 8,9,10.
Following packages can be installed via
apt-get
- automake
- make
- libtool
- clang (Build for java only)
Following packages can be installed via
brew
- automake
- make
- libtool
- gnu-sed
Native libraries for this project includes
libwallycoreand the other jni wrapper libraries. You only need to buildlibwallycoreonce since it's not frequently changed but you have to rebuild the jni libraries each time there is any changes in the jni codes.
Environment variables is required for building native libraries. For android,
NDK_HOME="your/ndk/home"is needed. For Java, you have to setCC="your/clang"before each build command.JAVA_HOME="your/java/home"also need for both.
Build libwallycore only
$ ./scripts/build-host.shBuild jni libraries only
$ ./scripts/build-jni.shRun following command for building all native libraries, includes libwallycore and jni libraries
$ ./scripts/build.shWorking directory:
/android
$ ANDROID_SDK_ROOT="your/android-sdk/home" ./gradlew clean connectedDebugAndroidTest$ ANDROID_SDK_ROOT="your/android-sdk/home" ./gradlew clean assembleReleaseThe
app-release.aarfile would be found inapp/build/outputs/aar. You can compile it as a library in your project.
Working directory:
/java
You need to install native libraries into
java.library.pathfor JVM can load it at runtime.
The test tasks automatically points JVM java.library.path to native libraries path so make sure you already built the native libraries before executing the tests.
Run following command for executing test cases.
$ ./gradlew testThe jar file will be bundled by running
$ ./gradlew assemble
jarfile just contain all.classfiles for running pure Java, no dynamic library is carried with.