How to Build Android Apps with Termux (without Root)






Video Tutorial here -




Installing dependencies

pkg update 

pkg install openjdk-17 nodejs wget -y




Installing Required tools for building the app


mkdir -p $PREFIX/opt/Android/sdk


nano ~/.bashrc


Paste following in it


export ANDROID_HOME="$PREFIX/opt/Android/sdk"

export PATH="$PATH:$ANDROID_HOME/cmdline-tools/latest/bin"

export JAVA_HOME=/data/data/com.termux/files/usr/opt/openjdk

export "PATH=$PATH:$PREFIX/opt/gradle/bin"


bash


Download gradle (v7.6) from here - https://gradle.org/releases/


Give storage access to termux


termux-setup-storage


copy downloaded gradle file to unzip


cp /sdcard/Download/gradle*.zip


unzip gradle*.zip -d $PREFIX/opt/


mv $PREFIX/opt/gradle* $PREFIX/opt/gradle





Get command-line tools from here


mkdir -p $PREFIX/opt/Android/sdk/cmdline-tools


wget <link to command line tools>


unzip commandlinetools-linux*.zip

mv cmdline-tools/ $PREFIX/opt/Android/sdk/cmdline-tools/latest/



yes | sdkmanager "platforms;android-34"



Get sdk-tools from here


wget <link to build-tools>


mv platform-tools/ $PREFIX/opt/Android/sdk/.



mkdir -p $PREFIX/opt/Android/sdk/build-tools/33.0.2/


mv build-tools/* $PREFIX/opt/Android/sdk/build-tools/33.0.2/.



npm install -g cordova


cd ~

cordova create app

cd ~/app

cordova platforms add android

cordova build



find -name gradle.properties


nano ./platforms/android/gradle.properties



Add following into it


--add-opens=java.base/java.io=ALL-UNNAMED #at the end of first line


android.aapt2FromMavenOverride=/data/data/com.termux/files/usr/opt/Android/sdk/build-tools/33.0.2/aapt2




cordova build



Post a Comment (0)
Previous Post Next Post