2012-10-11 12 views
14

Je veux créer un émulateur en ligne de commande avec quelques options, comme hw.mainKeys = false. J'ai besoin que ce soit un script shell, donc je peux exécuter un test d'automatisation, cependant here Je n'ai pas trouvé de place pour définir ces valeurs.comment créer un émulateur Android en ligne de commande avec des options?

android create avd 

n'a pas d'endroit où spécifier ces options.

Une alternative est de créer un AVD de type « plate-forme », cependant, la coquille est une coquille interactive qui est grand pour l'homme, mais difficile pour le 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>]: 

Y at-il des outils que je peux passer des options en tant que paramètres , comme --hw.mainKeys false?

Répondre

8

Vous pouvez créer un fichier texte avec les paramètres souhaités config.ini

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/ 

Voir la documentation officielle here

+1

comment puis-je utiliser plus tard le config.ini? –

+1

l'ai eu. il peut être copié dans le fichier name.avd /. Merci –

+4

Depuis août 2016, l'outil android n'est plus pris en charge, comme l'indique une note sur la page de documentation https://developer.android.com/studio/tools/help/android.html. Ceci, d'une part, explique, pourquoi je ne peux toujours pas le faire fonctionner correctement dans Travis CI, où j'utilise "android create avd" à partir d'une ligne de commande, et d'autre part, rend cette réponse obsolète - il semble que nous devons chercher une nouvelle façon de créer un émulateur à partir d'une ligne de commande ... – yvolk

2

Jetez un oeil à here

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

Je ne demande pas sur le nom, la cible, la peau. mais d'autres options –

+0

Ceci est la commande android obsolète, fyi. – AnneTheAgile

0

il suffit d'utiliser echo no | android create avd -n name -t 9

+0

ne fonctionne pas pour moi (Ubuntu 14.04, outils 25.1.7) –

+2

En ce qui concerne votre réponse, l'OP doit d'abord exécuter "cibles de la liste android" et sélectionnez la cible appropriée, il peut ne pas avoir la cible numéro 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

La commande non-désapprouvée a moins d'options en ligne de commande, mais ils sont:

$ $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. 
Questions connexes