1.下載sdk tools
android studio下載地址:
https://developer.android.com/studio/
下載sdk-tools-linux-4333796.zip
[root@iZj6c7eeosj2t5vjw8rf4xZ android]# wget https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip
[root@iZj6c7eeosj2t5vjw8rf4xZ android]# unzip sdk-tools-linux-4333796.zip
[root@iZj6c7eeosj2t5vjw8rf4xZ android]# cd android-sdk-linux
[root@iZj6c7eeosj2t5vjw8rf4xZ android-sdk-linux]# ls
tools
2.配置android環境變量
[root@iZj6c7eeosj2t5vjw8rf4xZ android-sdk-linux]# cd /etc/profile.d/
[root@iZj6c7eeosj2t5vjw8rf4xZ android-sdk-linux]# vim android.sh
在android.sh輸入然後保存
export ANDROID_HOME="/opt/frank/android/android-sdk-linux"
export PATH="$ANDROID_HOME/tools:$ANDROID_HOME/tools/bin:$ANDROID_HOME/platform-tools:$PATH"
保存配置,重新刷新配置
[root@iZj6c7eeosj2t5vjw8rf4xZ android-sdk-linux]# source profile
3.使用sdkmanager相關命令安裝build-tools, latforms, platform-tools
sdkmanager使用相關文檔:
https://developer.android.com/studio/command-line/sdkmanager
首先運行:sdkmanager –list
[root@iZj6c7eeosj2t5vjw8rf4xZ android-sdk-linux]# sdkmanager list
安裝build-tools的25.0.2版本
sdkmanager "build-tools;25.0.2"
安裝platform-tools,platforms的android-26版本
sdkmanager "platform-tools," "platforms;android-26"