2 minutes
Android development on debian/arm64
Introduction
Android studio is only available for linux running on amd64/x86_64. But it can still run with a few tricks, mainly by doing three things:
- Using the debian packaged jre/jdk instead of the bundled one
- Replacing one native .so included in the Android Studio
- Using qemu-user to execute some native tools and/or symlinking to debian supplied android tools.
Installing dependencies
we need qemu-user to execute some amd64 binaries from the android sdk, openjsd-21-jdk is needed to run android studio, the jre could have been enough, but we need also a jdk for building
Running amd64 binaries from the sdk is can be slow, and especially problematic on asahi linux which uses 16k page sizes. We will symlink some binaries to native ones later.
apt install openjdk-21-jdk qemu-user aapt zipalign
Downloading Android Studio
Download the x86_64 linux version as tar.gz here:
https://developer.android.com/studio
(tested with android-studio-2025.1.1.13-linux.tar.gz)
unpack downloaded file
# Do this in your preferred working dir,
# execute all commands in the same directory from now on.
# I chose ~Android
tar xvf ~/Downloads/android-studio-2025.1.1.13-linux.tar.gz
Removing the included jre
The jbr folder contains the jre which we do not want, there are a lot of amd64 binaries and libraries which will either not at all, or run or too slow with qemu-user
rm -rf android-studio/jbr
Getting the one really neccessary native lib
wget https://github.com/java-native-access/jna/raw/refs/heads/master/lib/native/linux-aarch64.jar
unzip linux-aarch64.jar
mv libjnidispatch.so android-studio/lib/jna/amd64/libjnidispatch.so
rm -rf META-INF # cleanup junk from the unpacked .jar
Now you are able to run android studio:
android-studio/bin/studio.sh
You will be asked to download the SDK and other components which should succeed. You might be asked for an SDK location also, where you can chose the debian installed one.
Optional: Improving performance by linking to debian supplied binaries
On Asahi Linux with 16k pages, this might be even necessary, because of the 4k/16k page mismatch.
export BUILD_TOOLS_VERSION=36.0.0 # replace this with the version you want to fix/improve performance for
rm build-tools/$BUILD_TOOLS_VERSION/aapt2
ln -s /usr/bin/aapt2 build-tools/$BUILD_TOOLS_VERSION/aapt2
rm build-tools/$BUILD_TOOLS_VERSION/zipalign
ln -s /usr/bin/zipalign build-tools/$BUILD_TOOLS_VERSION/zipalign
It might be wise to to this with other tools as well, but for me it was enough for now. ;)
350 Words
2025-08-17 23:23