sdkmanager operation instructions in Android development (for Delphi)

Table of contents

sdkmanager Description:

usage:

List installed and available packages

install package

update all installed packages

accept license

options


sdkmanager Description:

sdkmanager is a command-line tool that you can use to view, install, update, and uninstall Android SDK packages. If you use Android Studio, you don't need to use this tool, instead you can manage SDK packages from the IDE .

sdkmanager The tools are provided in  the Android SDK command-line tools package. To install a version of the command-line tools using the SDK Manager, follow these steps:

  1. Download the latest "command line tools only" package from  the Android Studio download page and unzip it.
  2. Move the unzipped  cmdline-tools directory to a new directory of your choice, for example  android_sdk . This new directory is your Android SDK directory.
  3. In the unzipped  cmdline-tools directory, create a  latest subdirectory named .
  4. Move the original  cmdline-tools directory contents (including  lib directories, bin directories, NOTICE.txt files, and  source.properties files) into the newly created  latest directory. You can now use the command line tools from this location.
  5. (Optional) To install legacy command-line tools, run the following command:

android_sdk/cmdline-tools/latest/bin/sdkmanager --install "cmdline-tools;version"

        will be  version replaced with the version you want to install, e.g. 5.0

Note : For local usage you can use  latest packages. For scripts, you should choose a specific version to ensure stability.

usage:

You can  sdkmanager list installed and available packages, install packages, and update packages with . See the sections below for more details.

List installed and available packages

To list installed and available packages, use the following syntax:

sdkmanager --list [options] \
           [--channel=channel_id] // Channels: 0 (stable), 1 (beta), 2 (dev), or 3 (canary)

Use  channel options to include  channel_idpackages from a certain channel to and from. For example, specify the Canary channel to list packages for all channels.

Note : To list only stable packages, use  or remove  option --channel=0 entirely  .--channel

install package

To install a package, use the following syntax:

sdkmanager packages [options]

The packages  parameter is  --list the SDK-style path listed by the command, enclosed in quotes. For example, "build-tools;33.0.1" or  "platforms;android-33".

You can pass multiple package paths (separated by spaces), but each path must be enclosed in its own set of quotes. For example, here's how to install the latest platform-tools and SDK-tools for API level 33:

sdkmanager "platform-tools" "platforms;android-33"

Alternatively, you can pass a text file specifying all packages:

sdkmanager --package_file=package_file [options]

The package_file  parameter specifies the location of a text file where each line represents an SDK-style path (without quotes) to a package to install.

To uninstall, add  --uninstall the flag:

sdkmanager --uninstall packages [options]
sdkmanager --uninstall --package_file=package_file [options]

To install CMake or NDK, use the following syntax:

sdkmanager --install
           ["ndk;major.minor.build[suffix]" | "cmake;major.minor.micro.build"]
           [--channel=channel_id] // NDK channels: 0 (stable), 1 (beta), or 3 (canary)

For example, use the following command to install a given NDK version (regardless of which channel it is currently on):

sdkmanager --install "ndk;21.3.6528147" --channel=3 // Install the NDK from the canary channel (or below)
sdkmanager --install "cmake;10.24988404" // Install a specific version of CMake

update all installed packages

To update all installed packages, use the following syntax:

sdkmanager --update [options]

accept license

You must accept the necessary licenses for each package you install. This step is done as part of the installation process when you install the package through Android Studio.

If you don't have Android Studio installed, or it's for a CI server or other headless Linux box that doesn't have a GUI installed, run the following command at the command line:

sdkmanager --licenses

You will be prompted to accept any licenses that have not been accepted.

options

The following table lists the available options for the commands listed in the previous section:

options illustrate
--sdk_root=path Use the specified SDK path instead of the SDK containing this tool.
--channel=channel_id Packages included in channels with channel_id inclusive. Available channels include:

0(Stable), 1(Beta), 2(Development), and  3(Canary).

--include_obsolete Include obsolete packages when listing or updating packages. Applies to  --list and  only --update.
--no_https Force all connections to use HTTP instead of HTTPS.
--newer When used  --list , only new or updatable packages are displayed.
--verbose Verbose output mode. This mode outputs error, warning, and informational messages.
--proxy={http | socks} Establish a connection through a proxy of the given type: with  http a proxy of the specified higher-level protocol (such as HTTP or FTP), or with  socks a proxy of the specified SOCKS (V4 or V5).
--proxy_host={ IP_address | DNS_address} The IP or DNS address of the proxy to use.
--proxy_port=port_number The proxy port number to connect to.

NOTE : Set the REPO_OS_OVERRIDE  environment variable to  "windows", "macosx" or  if you are installing packages for an operating system different from the current computer  "linux".

Guess you like

Origin blog.csdn.net/sensor_WU/article/details/132578561