How to create Android Virtual Device with command line and avdmanager?

前端 未结 3 1798
南笙
南笙 2020-12-23 17:12

I can not create a device with avdmanager command line:

$ Android/Sdk/tools/bin/avdmanager create avd --name Nexus6P --tag 11 --package \'system-images;andro         


        
相关标签:
3条回答
  • 2020-12-23 17:21

    The solution from @Gregriggins36 works. Here the detailed solution I use on Linux (Fedora 27)

    List the device definitions available:

    ~/Android/Sdk/tools/bin/avdmanager list
    ...
    ---------
    id: 11 or "Nexus 6P"
        Name: Nexus 6P
        OEM : Google
    ---------
    ...
    

    create a virtual device based on device definition "Nexus 6P"

    ~/Android/Sdk/tools/bin/avdmanager create avd --force --name Nexus6P --abi google_apis/x86_64 --package 'system-images;android-23;google_apis;x86_64' --device "Nexus 6P"

    list virtual devices available

    ~/Android/Sdk/tools/bin/avdmanager list avd
    Name: Nexus6P
    Device: Nexus 6P (Google)
    Path: /home/guillaume/.android/avd/Nexus6P.avd
    Target: Google APIs (Google Inc.)
            Based on: Android 6.0 (Marshmallow) Tag/ABI: google_apis/x86_64
    

    start the emulation of our new virtual device

    ~/Android/Sdk/tools/emulator -avd Nexus6P -skin 1440x2560

    0 讨论(0)
  • 2020-12-23 17:28

    If you don't care about it being a Nexus 6P, you can run

    echo no | Android/Sdk/tools/bin/avdmanager create avd --force --name testAVD --abi google_apis/x86_64 --package 'system-images;android-23;google_apis;x86_64'
    
    0 讨论(0)
  • 2020-12-23 17:33

    Here is my command that works on Mac.
    Notice:

    1. x86 and x86_64 are different ABIs.
    2. You need to download the system_image from sdkmanager first

    $  avdmanager create avd --force --name testAVD --abi google_apis/x86 --package 'system-images;android-23;google_apis;x86'
    
    Do you wish to create a custom hardware profile? [no] no
    
    $  avdmanager list avd
    
    
    Name: testAVD
    Path: /Users/xj/.android/avd/testAVD.avd
    Target: Google APIs (Google Inc.)
          Based on: Android 6.0 (Marshmallow) Tag/ABI: google_apis/x86
    
    0 讨论(0)
提交回复
热议问题