2012-10-11 60 views
14

Quiero crear un emulador en línea de comandos con algunas opciones, como hw.mainKeys = false. Necesito que sea un script de shell para que pueda ejecutarse en la prueba de automatización, sin embargo, here No pude encontrar un lugar para establecer esos valores.cómo crear un emulador de Android en línea de comandos con opciones?

android create avd 

no tiene lugar para especificar esas opciones.

Una alternativa es crear una AVD tipo 'plataforma', sin embargo, la pared es una pared interactiva que es grande para el ser humano, pero difícil para el script

Android 4.1 is a basic Android platform. 
Do you wish to create a custom hardware profile [no]yes 

Name of the AVD being run: 
avd.name [<build>]: 

¿Hay algunas herramientas que sólo puede pasar opciones como parámetros , como --hw.mainKeys false?

Respuesta

8

Puede crear config.ini archivo de texto con los parámetros deseados

hw.lcd.density=252 
sdcard.size=32M 
skin.name=NEXUS-ONE 
skin.path=platforms/android-10/skins/NEXUS-ONE 
hw.cpu.arch=arm 
hw.keyboard.lid=no 
abi.type=armeabi 
hw.keyboard=no 
vm.heapSize=24 
hw.ramSize=256 
image.sysdir.1=platforms/android-10/images/ 

Ver documentación oficial here

+1

cómo puedo usar el config.ini más adelante? –

+1

lo tengo. se puede copiar a name.avd/folder. Gracias –

+4

A partir de agosto de 2016, la "herramienta Android" ya no es compatible, como indica una nota en la página de documentación https://developer.android.com/studio/tools/help/android.html. Esto, por un lado, explica por qué todavía no puedo hacer que funcione correctamente en Travis CI, donde utilizo "android create avd" desde una línea de comandos, y por otro lado, desactualiza esta respuesta: parece que necesitamos busca alguna forma nueva de crear un emulador desde una línea de comandos ... – yvolk

2

Tome un vistazo a here

android create avd -n Ev o4G -t 9 -c 8000MB -s 480-800 
+1

No estoy preguntando sobre nombre, objetivo, máscara. pero otras opciones –

+0

Este es el comando de Android en desuso, fyi. – AnneTheAgile

0

sólo tiene que utilizar echo no | android create avd -n name -t 9

+0

no funcionan para mí (Ubuntu 14.04, herramientas 25.1.7) –

+2

En cuanto a su respuesta, el OP debe ejecutar primero "objetivos de la lista de Android" y seleccionar el objetivo relevante, es posible que no tenga el número de destino 9. –

3

De android --help create avd:

Usage: 
    android [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: 
    -t --target : Target ID of the new AVD. [required] 
    -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. 
    -p --path : Directory where the new AVD will be created. 
    -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. 
    -n --name : Name of the new AVD. [required] 
    -s --skin : Skin 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. 
    -f --force : Forces creation (overwrites an existing AVD) 
1

El comando no obsoleta tiene menos opciones de línea de comandos, pero son:

$ $ANDROID_HOME/tools/bin/avdmanager --help create 

Usage: 
     avdmanager [global options] create [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. 

Valid actions are composed of a verb and an optional direct object: 
- create avd   : Creates a new Android Virtual Device. 

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. 
Cuestiones relacionadas