I am trying to build an Android project on an arm64/aarch64 Debian server. Unfortunately the Android SDK only comes with a AMD64 compatible version of aapt2, which wont work to build the android project on arm. I found a aarch64/arm64 built binary of aapt2 on github here and it works:
https://github.com/JonForShort/android-tools/tree/master/build/android-9.0.0_r33/aapt2/arm64-v8a/bin https://github.com/JonForShort/android-tools/tree/master/build/android-11.0.0_r33/aapt2/arm64-v8a/bin
My question is if there is a way I can tell build.gradle to only use my binary of aapt2 instead of downloading it to somewhere in ~/.gradle/caches? So far I found a fix, but it only works with
classpath 'com.android.tools.build:gradle:4.1.1'
The fix is outlined here in this blogpost:
https://linuxtut.com/en/ec63aa8bff5103982156/
The TLDR of that blogpost is you can take the jar containing aapt2 in ~/.gradle/caches/.... and unzip it and replace the aapt2 binary with the amd64 compatible version of aapt2 and then rename it back to .jar . Then when you run a build again then it will use that jar containing the arm compatible aapt2 version.
The problem is if I change
classpath 'com.android.tools.build:gradle:4.2.0'
in gradle.build then it just downloads a binary of aapt2 (not inside a jar ) to:
$HOME/.gradle/caches/transforms-2/files-2.1/d26ef9244e179eadf69140d97f4d45bf/aapt2-4.2.0-7147631-linux/aapt2
even if I replace aapt2 in that location and rerun the build, then gradle will redownload the amd64 compatible version of aapt2 to that location.
That is why I would like to know how to use my arm64 compatible version of aapt2 on all my builds.
I've even tried copying it to /usr/bin/aapt2 and adding it to my path, but that also didn't work.
Thanks in advance for your help.