Mobile termux with gradle to build APK tutorial

First download termux
https://www.coolapk.com/apk/com.termux
open and wait for the initialization to be completed as shown in the figure. Insert picture description here
First download the auxiliary program
pkg install proot
one by one, don’t worry
pkg install git
pkg install wget
pkg install curl
pkg install kona
pkg install bsdtar
then download Arch Linux terminal to copy the script below, performs
wget https://github.com/SDRausty/TermuxArch/raw/master/setupTermuxArch.bash && bash setupTermuxArch.bash
success process is shown Insert picture description here
Insert picture description here
input into startarch Linux then download the data packet
if If you do not download these 3 data packages, the Insert picture description here
installation will fail as shown in the figure . One by one can not be rushed
pacman -S unzip

pacman -S zip

pacman-key --init && pacman-key --populate archlinuxarm

Then install sdkman
curl -s "https://get.sdkman.io" | bash

Open the command
source of sdkman "$HOME/.sdkman/bin/sdkman-init.sh"

Check the version,
after entering it will display the currently installed version
sdk version
Download gradlesdk in sdkman
sdk install gradle 6.2.1

Create this favorite folder
and then return to Linux and install jdk in it. This is the download and unzip
wget of arm64 https://github.com/VcotyQin/TermuxWithGradle/raw/master/jdk8_arm64/jdk-8u221-linux-arm64-vfp-hflt .tar.gz && tar xzvf jdk-8u221-linux-arm64-vfp-hflt.tar.gz
Insert picture description here
Then download the editor
pacman -S vim to
configure the environment variables,
execute vim /etc/profile, enter i, and then edit and slide to the bottom to enter

set java environment                                    export JAVA_HOME=#文件路径/jdk1.8.0_241         export CLASSPATH=.:$CLASSPATH:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin
export JRE_hOME=$JAVA_HOME/jre

Insert picture description here

Save and press ESC Enter: wq Enter
source and
enter source /etc/profile and
enter java to verify whether the pairing is successful

Then install the SDK
and create a directory
mkdir android_sdk && cd android_sdk under Linux

Install Android SDK Toolswget https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip && unzip sdk-tools-linux-4333796.zip
may not be the latest, it is recommended to go to the official website to copy the official website link https://developer.android.com/studio/

Configure environment variables under Linux, execute vim /etc/profile, enter i, slide to the bottom and paste

export
ANDROID_HOME=/data/data/com.termux/files/home/android_sdk#这是SDK路径export PATH=$ANDROID_HOME/tools:$PATHexport PATH=$ANDROID_HOME/tools/bin:$PATHexport PATH=$ANDROID_HOME/platform-tools:$PATH

Insert picture description here
Save and exit etc; wq enter and then
source /etc/profile
and use sdkmanager to install build-tools, platform-tools and platforms

sdkmanager "platform-tools" "build-tools;29.0.3" "platforms;android-29"

Adapt termux

wget https://raw.githubusercontent.com/VcotyQin/TermuxWithGradle/master/adaptTermuxARM64.sh && chmod 777 adaptTermuxARM64.sh && ./adaptTermuxARM64.sh

Overwrite aapt, aapt2 to android_sdk/build-tools/

cd Path to Androidsdk
Insert picture description here
cd 29.0.2
Enter l
rm -rf aapt
rm -rf aapt2
Insert picture description here
wget https://raw.githubusercontent.com/VcotyQin/TermuxWithGradle/master/aapt/arm64/aapt

wget https://raw.githubusercontent.com/VcotyQin/TermuxWithGradle/master/aapt/arm64/aapt2
Insert picture description here

After downloading, give permission
chmod 755 aapt
chmod 755 aapt2

Finally install glibc

pacman -S glibc
completed!
Insert picture description here
Compile with gradle and cd to path execution

gradle build

You can start to compile.
Insert picture description here
An old brother Vcoty from Ku'an wrote a tutorial. If it is not very detailed, no one may understand it!
There is no such article
on CSDN, plagiarism is prohibited!

Guess you like

Origin blog.csdn.net/jiulang9/article/details/104445310