It may be a good idea to document what packages should be installed and what are the tools versions you know this example to work.
It is, currently, working for me with the following packages provided by archlinux:
Rust 1.70
Java 8 -- any newer java failed on the final steps
android-ndk r25.c-2 -- lastest version available to Arch
android-platform-25 7.1.1_r03-2 -- 34 is available, but this must match the NDK version
android-sdk 26.1.1-2.1
android-sdk-build-tools-25 r25-1 -- idem
android-sdk-cmdline-tools-latest 9.0-1
android-sdk-platform-tools 34.0.3-1
android-studio 2022.2.1.20-1
android-tools 34.0.1-2
aarch64-linux-android -- through "rustup target add aarch64-linux-android"
I added BUILD_ANDROID.md with some info.
About your java issues, it seems related to android-studio or maybe your cargo-apk is little outdated.
I'm using cargo-apk v0.9.7 and OpenJDK 18.0.2-ea
Thanks for sharing this code.
It may be a good idea to document what packages should be installed and what are the tools versions you know this example to work.
It is, currently, working for me with the following packages provided by archlinux: Rust 1.70 Java 8 -- any newer java failed on the final steps android-ndk r25.c-2 -- lastest version available to Arch android-platform-25 7.1.1_r03-2 -- 34 is available, but this must match the NDK version android-sdk 26.1.1-2.1 android-sdk-build-tools-25 r25-1 -- idem android-sdk-cmdline-tools-latest 9.0-1 android-sdk-platform-tools 34.0.3-1 android-studio 2022.2.1.20-1 android-tools 34.0.1-2 aarch64-linux-android -- through "rustup target add aarch64-linux-android"