How to create an emulator without using ide?

3

I need to emulate android on my machine, but I did not want to use a virtual machine because it would use a lot of features, I wanted to use android studio's sdk tools, but I also did not want to install android studio for that.

So I downloaded sdk tools on the android studio site and tried to run, in the old versions I had a gui and it was very simple to create and run, but in the current version it does not have it, it's all via command, I tried to run some more none were successful.

I did this:

C:\Users\Futurotec\Downloads\sdk-tools-windows-3859397\tools>android
**************************************************************************
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
**************************************************************************

Invalid or unsupported command ""

Supported commands are:
android list target
android list avd
android list device
android create avd
android move avd
android delete avd
android list sdk
android update sdk

Then I tried to run the android create avd command:

C:\Users\Futurotec\Downloads\sdk-tools-windows-3859397\tools>android create avd
**************************************************************************
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
**************************************************************************

Invoking "C:\Users\Futurotec\Downloads\sdk-tools-windows-3859397\tools\bin\avdmanager" create avd

Error: The parameters --package, --name must be defined for action 'create avd'

Usage:
      avdmanager [global options] create avd [action options]
      Global options:
  -s --silent     : Silent mode, shows errors only.
  -v --verbose    : Verbose mode, shows errors, warnings and all messages.
     --clear-cache: Clear the SDK Manager repository manifest cache.
  -h --help       : Help on a specific command.

Action "create avd":
  Creates a new Android Virtual Device.
Options:
  -a --snapshot: Place a snapshots file in the AVD, to enable persistence.
  -c --sdcard  : Path to a shared SD card image, or size of a new sdcard for
                 the new AVD.
  -g --tag     : The sys-img tag to use for the AVD. The default is to
                 auto-select if the platform has only one tag for its system
                 images.
  -p --path    : Directory where the new AVD will be created.
  -k --package : Package path of the system image for this AVD (e.g.
                 'system-images;android-19;google_apis;x86'). [required]
  -n --name    : Name of the new AVD. [required]
  -f --force   : Forces creation (overwrites an existing AVD)
  -b --abi     : The ABI to use for the AVD. The default is to auto-select the
                 ABI if the platform has only one ABI for its system images.
  -d --device  : The optional device definition to use. Can be a device index
                 or id.

I tried several parameters, but none created the emulator.

I also tried to use the avdmanager direct command, but it presented the same messages.

In all my searches I only found solutions that needed to open android studio or that the commands were from the old versions.

    
asked by anonymous 18.09.2017 / 20:56

1 answer

3

TL; DR

A valid command example to create an avd:

avdmanager create avd -n "Meu-Emulador" -k "system-images;android-26;google_apis_playstore;x86"

avdmanager

The program used to create AVDs is avdmanager . It is located at sdk/tools/bin/avdmanager . android would also work, but it ends up using avdmanager below.

For the creation of an AVD two parameters are required:

  • -n or --name to name the AVD
  • -k or --package to indicate which system image to use

System images

For the creation of AVDs it is mandatory to indicate a system image. To list the installed images, use the command without the -k parameter:

avdmanager create avd -n "Meu-Emulador"

If no image is listed, it means that none have been installed. The installation of new images can be done using sdkmanager .

To list available packages:

sdkmanager --list --verbose

Note: --verbose was used to not truncate package names .

To install an image:

sdkmanager "system-images;android-26;google_apis;x86"

Running avd in the emulator

To start the emulator, use the program emulator , located in sdk/tools/emulator , informing the name of the AVD to be executed:

emulator -avd "Meu-Emulador"
    
20.09.2017 / 12:50