Mac Terminal - How to start Android Virtual Device Manager on CLI?

前端 未结 5 1855
独厮守ぢ
独厮守ぢ 2020-12-15 06:23

I am currently developing a mobile web application and I don\'t have a test device yet so I\'m using the android-emulator to check the site. On my mac, I have installed the

相关标签:
5条回答
  • 2020-12-15 06:45

    Go to tools directory inside your android sdk like:

    cd ~/Android/Sdk/tools
    

    and enter run your avd as

    ./emulator -avd <your-avd>
    

    You can find your avd name by running:

    ./emulator -list-avds
    
    0 讨论(0)
  • 2020-12-15 06:47

    Use the Android SDK Tools:

    avdmanager
    

    Or you can also start it by using the command below but it's deprecated though on newer version. Before executing it, make sure to export your Android SDK's tools directory in your ~/.bash_profile (i.e. export PATH="/Users/user/Software/android-sdk-macosx/tools:$PATH")

    android avd
    

    Old answer:

    In order to open the avd manager on terminal, execute the following:

    /usr/bin/java -Xmx256M -XstartOnFirstThread \
     -Dcom.android.sdkmanager.toolsdir=/path/of/android-sdk-macosx/tools \
     -classpath /path/of/android-sdk-macosx/tools/lib/sdkmanager.jar:/path/of/android-sdk-macosx/tools/lib/swtmenubar.jar:/path/of/android-sdk-macosx/tools/lib/x86_64/swt.jar \
     com.android.sdkmanager.Main avd
    
    0 讨论(0)
  • 2020-12-15 06:50

    I was able to open it from terminal with:

    android avd
    

    You may need to navigate to your SDK tools/ first. Here is reference I used: AVD Manager

    0 讨论(0)
  • 2020-12-15 06:56

    this is just a small addon to previous solutions presented. What is probably handy to do is to just jam this as a alias into your bash_profile like so:

    Open your bash_profile:

    nano ~/.bash_profile

    Add this:

    alias avd='cd /path-to-sdk/tools; ./android avd'

    Source it again:

    source ~/.bash_profile

    In the CLI type:

    avd

    Now you can open up the AVD by just using avd in the command line. The only thing i haven't figured out how to make it stay alive after closing the terminal. Maybe somebody has tips on that.

    0 讨论(0)
  • 2020-12-15 07:04

    You can start emulator use terminal shell

    emulator -avd <avd_name> [<options>]
    

    options can be special -http-proxy, -dns-server setting. Get more options here

    And to list all avd you can use:

    emulator -list-avds
    

    result like following:

    4.7_WXGA_API_23
    Nexus_5X_Edited_API_23
    

    Example when I start Nexus_5X_Edited_API_23 emulator in OS X 10.11 with proxy setting

    ~/Library/Android/sdk/tools/emulator -netdelay none -netspeed full -avd Nexus_5X_Edited_API_23 -http-proxy http://username:password@local_server:8080
    
    0 讨论(0)
提交回复
热议问题