We can now use Substrate without having to manually add jdk libs or jvm libs.
I tagged the merge commit that allows to build the static libs in my fork with 24-mobile1
As mentioned on July 1:
Use Gluon Substrate from https://github.com/johanvos/substrate/tree/jdk22 Follow the instructions from docs.gluonhq.com to run on Linux and build on Android.However, the latest Java code used in the labsjdk requires more native functions that are not implemented in the static jdk libs for Java 18, which are used inside Substrate. Therefore, a build of the recent jdk libs is needed. You can find a build at jdklibs-android-aarch64-23.tgz. Use these libraries instead of the 18-based ones. This can be done by replacing
-L/home/johan/.gluon/substrate/javaStaticSdk/18-ea+prep18-9/android-aarch64/staticjdk/lib/staticwith the link to the directory where you unpacked the new libs, e.g.
-L/tmp/jdklibs
How to build those jdklibs yourself? The libs that are uploaded here are built from openjdk/mobile, from commit deb4256a4d9cad7475a8eecad8860135bbdfd483
bash configure \ --enable-headless-only \ --with-boot-jdk=/opt/jdk-22 \ --with-build-jdk=/opt/jdk-23 \ --with-toolchain-path=/opt/android-ndk-r26c/toolchains/llvm/prebuilt/linux-x86_64/bin \ --with-sysroot=/opt/android-ndk-r26c/toolchains/llvm/prebuilt/linux-x86_64/sysroot \ --with-toolchain-type=clang \ --with-jvm-variants=minimal \ --host=aarch64-linux-android \ --target=aarch64-linux-android cd build/android-aarch64-minimal-release make static-libs mkdir jdklibs cp `find . -name "*.a"` jdklibs/ tar -zcvf jdklibs-android-aarch64-23.tgz jdklibs
Donwload GraalVM from which is based on https://github.com/johanvos/graal/tree/2024-june and the static labsjdk from https://github.com/graalvm/labs-openjdk/releases/tag/23%2B25-jvmci-b01. Use Gluon Substrate from https://github.com/johanvos/substrate/tree/jdk22 Follow the instructions from docs.gluonhq.com to run on Linux and build on Android.
Three libraries are added to a regular XCode project:
I started from the OpenJDK head and fixed issues one by one. While doing this, I tried to keep track of the changes I had to made (why/how). Those changes (that ended up in the commits) are documented here: