2012-10-11 31 views
14

Chcę utworzyć emulator w linii poleceń z niektórymi opcjami, takimi jak hw.mainKeys = false. Potrzebuję go, aby był skryptem powłoki, więc można uruchomić na test automatyzacji, jednak here Nie mogłem znaleźć miejsca, aby ustawić te wartości.jak stworzyć emulator Androida w linii poleceń z opcjami?

android create avd 

nie ma miejsca na określenie tych opcji.

Alternatywą jest utworzenie „platformy” typ Avd jednak, że powłoka jest interaktywna powłoka, która jest dobre dla człowieka, ale trudne do skryptu

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>]: 

istnieją pewne narzędzia mogą po prostu przejść opcje jak parametrach , jak --hw.mainKeys false?

Odpowiedz

8

Można tworzyć plików tekstowych config.ini o pożądanych parametrach

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/ 

Zobacz oficjalną dokumentację here

+1

jak mogę użyć config.ini później? –

+1

rozumiem. można go skopiować do pliku name.avd /. Dzięki –

+4

Od sierpnia 2016 r. "Narzędzie Android" nie jest już obsługiwane, jak stwierdza notatka na stronie dokumentacji https://developer.android.com/studio/tools/help/android.html. To, z jednej strony, wyjaśnia, dlaczego wciąż nie mogę go poprawnie uruchomić w Travis CI, gdzie używam "android create avd" z linii poleceń, az drugiej strony, ta odpowiedź jest przestarzała - wygląda na to, że musimy szukać jakiegoś nowego sposobu na tworzenie emulatora z linii poleceń ... – yvolk

2

Spójrz na here

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

Nie pytam o imię, cel, skórę. ale inne opcje –

+0

To jest zaniechane polecenie android, fyi. – AnneTheAgile

0

wystarczy użyć echo no | android create avd -n name -t 9

+0

nie działają dla mnie (Ubuntu 14.04, narzędzia 25.1.7) –

+2

Co do odpowiedzi, OP powinien najpierw uruchomić "cele listy androidów" i wybrać odpowiedni cel, może nie mieć docelowej liczby 9. –

3

Od 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

Komenda non-Nieaktualne ma mniej opcji wiersza poleceń, ale są to:

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