Could you just use raw javac, d8 and aapt2 with some open-source Android SDK alternative like the Debian Android SDK: <https://tracker.debian.org/pkg/android-sdk-meta>