[英]How to pass command line options to the emulator in Android Studio?
[英]how to create android emulator in command line with options?
我想在命令行中使用一些選項創建模擬器,例如hw.mainKeys = false
。 我需要它是一個 shell 腳本,以便可以在自動化測試中運行,但是在這里我找不到設置這些值的地方。
android create avd
沒有地方指定這些選項。
一種替代方法是創建一個“平台”類型的 avd,然而,shell 是一個交互式 shell,對人類來說很好,但對腳本來說很難
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>]:
是否有一些工具可以將選項作為參數傳遞,例如--hw.mainKeys false
?
您可以使用所需的參數創建文本文件 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/
在這里查看官方文檔
從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)
看看這里
android create avd -n Ev o4G -t 9 -c 8000M -s 480-800
非棄用命令的命令行選項較少,但它們是:
$ $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.
只需使用echo no | android create avd -n name -t 9
echo no | android create avd -n name -t 9
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.