Skip to content

Instantly share code, notes, and snippets.

@JonDouglas JonDouglas/sdktoolscli.md Secret
Last active Jan 2, 2018

Embed
What would you like to do?
TechnicalBulletinSDKToolsCLI

Technical Bulletin: Android SDK CLI Tooling

As of Android SDK Tools version 26.0.1 and greater, Google has removed support to their existing avd/sdk managers in favor of their new CLI(Command Line Interface) tools.

Because of this deprecation change to the android program, the GUI(Graphical User Interface) managers will no longer work past Android SDK Tools version 26.0.1.

This also means that the Android IDE menus in Visual Studio / Visual Studio for Mac will no longer work.

Attempting to use the android program via the command line will result in an error message like the following:

The "android" command is deprecated.
For manual SDK, AVD, and project management, please use Android Studio.
For command-line tools, use tools\bin\sdkmanager.bat
and tools\bin\avdmanager.bat

Thus you will need to use the CLI tools to manage and update your emulators and Android SDK.

CLI Tools

sdkmanager

Added In: Android SDK Tools 25.2.3 and higher.

There is a new program called sdkmanager in the tools/bin folder of your Android SDK.

sdkmanager --list - Will list packages that are installed and available to download.

sdkmanager packages [options] - Will download the package(s) specified.

sdkmanager --uninstall packages [options] - Will uninstall the package(s) specified.

sdkmanager --update [options] - Will update the package(s) specified. With no options set, it will update all installed packages.

For more information on this topic:

https://developer.android.com/studio/command-line/sdkmanager.html

avdmanager

Added In: Android SDK Tools 25.3.0 and higher.

There is a new program called avdmanager in the tools/bin folder of your Android SDK. You can find out more on the basic usage of this tooling here:

avdmanager create avd -n name [options] - Creates a new AVD with the respective name.

avdmanager delete avd -n name [options] - Deletes an AVD with the respective name.

avdmanager move avd -n name [options] - Moves and/or renames an AVD with the respective name.

list [target|device|avd] [options] - Lists all available targets, devices, or AVDs.

For more information on this topic:

https://developer.android.com/studio/command-line/avdmanager.html

Downgrading

You can downgrade your Android SDK Tools version by installing the 25.2.3 version from the Android SDK website:

https://developer.android.com/studio/index.html

Please note that you can only update to Android SDK Tools version 25.2.5 this way.

Using the old GUI

You can still use the original GUI by running the android program inside your tools folder as long as you are on Android SDK Tools version 25.2.5 or lower.

@jrgcubano

This comment has been minimized.

Copy link

commented Jun 7, 2017

Just in case anyone getting some errors trying to create an avd on MAC OS!

I was getting:

cd /Users/XXXXXXX/Library/Developer/Xamarin/android-sdk-macosx/tools/bin 
./avdmanager create avd -n test -k "system-images;android-25;google_apis;x86"
.........
AVD not created
null

The steps I follow to solve the problem:

From Visual Studio for Mac

  • Tools -> SDK Manager -> Tools -> Android SDK Tools -> Back to Android SDK Tools 25.2.5 -> Apply Changes

From Command line

  • cd /Users/XXXXXXX/Library/Developer/Xamarin/android-sdk-macosx/tools (old tools)
  • ./android (old gui)
  • I was getting many "broken" images in Extras folder.
  • Removed all broken images and apply
  • Reinstalled images and apply
    ** Google APIs Intel x86 Atom System Image
    ** Google APIs ARM EABI v7a System Image

From Visual Studio for Mac

  • Tools -> SDK Manager -> Tools -> Install Android SDK Tools 26.0.2 (this remove 25.2.5 tools) -> Apply Changes

From Command line

  • cd /Users/XXXXXXX/Library/Developer/Xamarin/android-sdk-macosx/tools/bin (new tools)
  • ./avdmanager create avd -n test -k "system-images;android-25;google_apis;x86"

If needed stop docker to allow HAX:
docker-machine ls
docker stop dev (dev example container)
quick docker

Run avd with emulator

  • cd /Users/XXXXXXX/Library/Developer/Xamarin/android-sdk-macosx/tools
    ./emulator -avd test

Done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.