avdmanagerコマンドによるAndroidエミュレーターの作成

Android SDKをインストールしてみました。
Ubuntu 16.04にAndroid SDKをインストール

avdmanagerコマンドでAndroidエミュレーターを作成する方法がよくわからなかったので調べてみます。


まず、コマンドのヘルプを表示。


$ tools/bin/avdmanager -h

Usage:
     avdmanager [global options] [action] [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:
- list             : Lists existing targets or virtual devices.
- list avd         : Lists existing Android Virtual Devices.
- list target     : Lists existing targets.
- list device     : Lists existing devices.
- create avd         : Creates a new Android Virtual Device.
- move avd         : Moves or renames an Android Virtual Device.
- delete avd         : Deletes an Android Virtual Device.





「avdmanager create avd」でエミュレーターを作成
作成時のオプションは以下のとおり。


$ tools/bin/avdmanager create avd
Error: The parameter --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').
-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.






使用できるデバイスのリストを「avdmanager list device」で表示してみます。


$ tools/bin/avdmanager list device
Available devices definitions:
id: 0 or "tv_1080p"
    Name: Android TV (1080p)
    OEM : Google
    Tag : android-tv
---------
id: 1 or "tv_720p"
    Name: Android TV (720p)
    OEM : Google
    Tag : android-tv
---------
id: 2 or "wear_round"
    Name: Android Wear Round
    OEM : Google
    Tag : android-wear
---------
id: 3 or "wear_round_chin_320_290"
    Name: Android Wear Round Chin
    OEM : Google
    Tag : android-wear
---------
id: 4 or "wear_square"
    Name: Android Wear Square
    OEM : Google
    Tag : android-wear
---------
id: 5 or "Galaxy Nexus"
    Name: Galaxy Nexus
    OEM : Google
---------
id: 6 or "Nexus 10"
    Name: Nexus 10
    OEM : Google
---------
id: 7 or "Nexus 4"
    Name: Nexus 4
    OEM : Google
---------
id: 8 or "Nexus 5"
    Name: Nexus 5
    OEM : Google
---------
id: 9 or "Nexus 5X"
    Name: Nexus 5X
    OEM : Google
---------
id: 10 or "Nexus 6"
    Name: Nexus 6
    OEM : Google
---------
id: 11 or "Nexus 6P"
    Name: Nexus 6P
    OEM : Google
---------
id: 12 or "Nexus 7 2013"
    Name: Nexus 7
    OEM : Google
---------
id: 13 or "Nexus 7"
    Name: Nexus 7 (2012)
    OEM : Google
---------
id: 14 or "Nexus 9"
    Name: Nexus 9
    OEM : Google
---------
id: 15 or "Nexus One"
    Name: Nexus One
    OEM : Google
---------
id: 16 or "Nexus S"
    Name: Nexus S
    OEM : Google
---------
id: 17 or "pixel"
    Name: Pixel
    OEM : Google
---------
id: 18 or "pixel_c"
    Name: Pixel C
    OEM : Google
---------
id: 19 or "pixel_xl"
    Name: Pixel XL
    OEM : Google
---------
id: 20 or "2.7in QVGA"
    Name: 2.7" QVGA
    OEM : Generic
---------
id: 21 or "2.7in QVGA slider"
    Name: 2.7" QVGA slider
    OEM : Generic
---------
id: 22 or "3.2in HVGA slider (ADP1)"
    Name: 3.2" HVGA slider (ADP1)
    OEM : Generic
---------
id: 23 or "3.2in QVGA (ADP2)"
    Name: 3.2" QVGA (ADP2)
    OEM : Generic
---------
id: 24 or "3.3in WQVGA"
    Name: 3.3" WQVGA
    OEM : Generic
---------
id: 25 or "3.4in WQVGA"
    Name: 3.4" WQVGA
    OEM : Generic
---------
id: 26 or "3.7 FWVGA slider"
    Name: 3.7" FWVGA slider
    OEM : Generic
---------
id: 27 or "3.7in WVGA (Nexus One)"
    Name: 3.7" WVGA (Nexus One)
    OEM : Generic
---------
id: 28 or "4in WVGA (Nexus S)"
    Name: 4" WVGA (Nexus S)
    OEM : Generic
---------
id: 29 or "4.65in 720p (Galaxy Nexus)"
    Name: 4.65" 720p (Galaxy Nexus)
    OEM : Generic
---------
id: 30 or "4.7in WXGA"
    Name: 4.7" WXGA
    OEM : Generic
---------
id: 31 or "5.1in WVGA"
    Name: 5.1" WVGA
    OEM : Generic
---------
id: 32 or "5.4in FWVGA"
    Name: 5.4" FWVGA
    OEM : Generic
---------
id: 33 or "7in WSVGA (Tablet)"
    Name: 7" WSVGA (Tablet)
    OEM : Generic
---------
id: 34 or "10.1in WXGA (Tablet)"
    Name: 10.1" WXGA (Tablet)
    OEM : Generic





前回作成した「test」というエミュレーターを削除。


$ tools/bin/avdmanager delete avd --name test




32(5.4in FWVGA)を指定して、エミュレーターを作成します。
100MのSDカードを挿入した状態にしています。


$ tools/bin/avdmanager create avd --name test --device 32 --package "system-images;android-23;google_apis;x86" --abi x86 --sdcard 100M




cordovaからエミュレーターを起動してみます。


$ cordova emulate android



756_01.png


いい感じです。
関連記事

コメント

非公開コメント

プロフィール

Author:symfo
blog形式だと探しにくいので、まとめサイト作成中です。
Symfoware まとめ

PR




検索フォーム

月別アーカイブ