Refer to the official website documentation: sdkmanager | Android Developers | Android Developers (google.cn)
Download the Tools installation package
Official website download address: Download Android Studio & App Tools - Android Developers (google.cn)
wget https://dl.google.com/android/repository/commandlinetools-linux-9477386_latest.zip
Create home directory
mkdir /usr/local/android-sdk
Unzip the zip package downloaded in the previous step to this directory
mv commandlinetools-linux-9477386_latest.zip /usr/local/android-sdk
cd /usr/local/android-sdk
unzip commandlinetools-linux-9477386_latest.zip
Go to cmdline-tools
the directory and create a latest
subdirectory named
cd cmdline-tools && mkdir latest
cmdline-tools
Move the contents of the current directory (including lib
directories, bin
directories, NOTICE.txt
files and source.properties
files) to the newly created latest
directory under the current directory
mv * latest/
Configure environment variables
vim /etc/profile
export ANDROID_HOME=/usr/local/android-sdk
export PATH=$ANDROID_HOME/cmdline-tools/latest/bin:$PATH
usage
List all installation packages
sdkmanager --list
Install specified version package
Install "build-tools;33.0.0" and "platforms;android-33". The name of the package sdkmanager --list
can be found through the command
sdkmanager "build-tools;33.0.0" "platforms;android-33"
Note: If you use Dockerfile to build an image, the first installation of the SDK package inside the image will ask us to enter it once to y
confirm. It is recommended to use docker run to run the image to pre-install an SDK package and omit it y
, and then use the docker commit command to repackage the image. Avoid being unable to enter y
and causing unsuccessful installation of the sdk