1.先安装java环境(此处我安装的是amazon的jdk)
java8 后续环境需java17
wget https://corretto.aws/downloads/latest/amazon-corretto-8-x64-linux-jdk.tar.gz
sudo wget wget https://corretto.aws/downloads/latest/amazon-corretto-17-x64-linux-jdk.tar.gz
解压
sudo tar -zxvf amazon-corretto-8-x64-linux-jdk.tar.gz
sudo tar -zxvf amazon-corretto-17-x64-linux-jdk.tar.gz
2.安装android的commandlinetools工具
sudo wget https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip
sudo unzip commandlinetools-linux-11076708_latest.zip
3.将java及android工具加入环境变量
sudo vim /etc/profile
export JAVA_HOME=/env/amazon-corretto-17.0.12.7.1-linux-x64
export SDK_HOME=/env/cmdline-tools
export PATH=$PATH:$JAVA_HOME/bin:$SDK_HOME/bin:$SDK_HOME/tools:$SDK_HOME/platform-tools
4.下载合适的android编译工具
# 可通过--list 查看安装状态
sdkmanager --sdk_root=/mkandroid/sdk --list
sudo -E ./sdkmanager --sdk_root=/mkandroid/sdk --install "platforms;android-34"
sudo -E ./sdkmanager --sdk_root=/mkandroid/sdk --install "build-tools;34.0.0"
sudo -E ./sdkmanager --sdk_root=/mkandroid/sdk --install "ndk;21.1.6352462"