install termux from F-Droid.
apt update
apt upgrade
# source.list changed
apt update
termux-setup-storage
apt install git wget proot
git clone https://github.com/MFDGaming/ubuntu-in-termux.git
cd ubuntu-in-termux
# install ubuntu
bash ubuntu.sh -y
# fix PATH order
sed -Ei 's|(:/bin)(:/usr/bin):|\2\1:|' startubuntu.sh
# start
./startubuntu.sh
Now, in ubuntu.
apt update
apt upgrade
apt install default-jdk-headless openjdk-8-jdk-headless unzip aapt2
Download Android Command Line Tools for Linux
from https://developer.android.com/studio
cd ~
unzip /sdcard/Download/commandlinetools-linux-9477386_latest.zip
export ANDROID_HOME=$HOME/android/sdk
mkdir -p $ANDROID_HOME/cmdline-tools
mv cmdline-tools $ANDROID_HOME/cmdline-tools/latest
export PATH=$PATH:$ANDROID_HOME/cmdline-tools/latest/bin
# just for fix broken dependencies
JAVA_OPTS=-Dos.arch=amd64 sdkmanager emulator
# install target platforms
sdkmanager 'platforms;android-26'
cd project-dir
echo "sdk.dir=$ANDROID_HOME" > local.properties
alias gradlew='JAVA_HOME=/usr/lib/jvm/java-8-openjdk-arm64 bash ./gradlew'
# first build should fail. it is for downloading aapt2-*-linux.jar
gradlew
# replace aapt2 binary for arm64
find ~/.gradle -name 'aapt2-*-linux.jar' -type f | xargs -I{} jar -u -f {} -C /usr/bin aapt2
cd project-dir
gradlew
In that case you can use CodeAssist, either the official one or the unofficial Deenu's CodeAssist. (This one recommended)