This crate provides the JNI bindings for using Cozo in Java/JVM languages/Android.
You do not use this crate directly. Instead, use:
- Cozo Java for Java or other JVM languages
- Cozo Clojure for Clojure on JVM (you can also use the Java library, but this one is nicer)
- Cozo Android for Android
Keep reading only if the prebuilt binaries provided by these libraries do not suit your needs.
With the Rust toolchain installed,
cargo build --release -p cozo_java -F storage-rocksdb
Building for Android is not easy, and we will be very sketchy.
The first thing to note is that you should omit -F storage-rocksdb
from the build command above,
unless you are prepared to manually change lots of build.rs
flags in
cozorocks to build the RocksDB dependency.
Then, in addition to adding Android targets to the Rust toolchain, you also need to set up the Android NDK cross-compilation and libraries paths, etc. This is notoriously hard to get right, but fortunately you can just use the Docker image here which has everything set up for you.
When everything is set up correctly, the following command show complete without errors:
for TARGET in aarch64-linux-android armv7-linux-androideabi i686-linux-android x86_64-linux-android; do
cross build -p cozo_java --release --target=$TARGET
done
For running on modern Android phones, the single target aarch64-linux-android
is probably enough.