Install android SDK, specify sdk version

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-toolsthe directory and create a latestsubdirectory named

cd cmdline-tools && mkdir latest

cmdline-toolsMove the contents of the current directory (including libdirectories, bindirectories, NOTICE.txtfiles and source.propertiesfiles) to the newly created latestdirectory 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 --listcan 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 yconfirm. 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 yand causing unsuccessful installation of the sdk

Guess you like

Origin blog.csdn.net/zhanremo3062/article/details/131837505