Run android emulator using command line

北城余情 提交于 2021-01-28 22:28:55

问题


I am running latest version of Mac OS and I want to run android emulator through command line tool. I have run the following command on Mac terminal and got the following error.

 $ emulator -list-avds
Pixel_XL_API_28

 $ emulator -avd Pixel_XL_API_28
PANIC: Missing emulator engine program for 'x86' CPU.

I also run the command with available options like below that is also available on official documentation developer.android.com

$ /Users/janedoe/Library/Android/sdk/emulator/emulator -avd Pixel_XL_API_28 -netdelay none -netspeed full

What I need to do, so that I don't need to open android studios every time for only opening simulator.


回答1:


Please follow the steps in your terminal in Mac

 Step 1 ( Add Environment Variable )
 export ANDROID_HOME=/Users/$(whoami)/Library/Android/sdk
 export PATH=$PATH:$ANDROID_HOME/platform-tools
 export PATH=$PATH:$ANDROID_HOME/tools

 Step 2 ( .bash_profile / .bashrc ) 
 Reload you .bash_profile Or .bashrc depending on OS

 Step 3 ( go to emulator directory )
 cd /Users/$(whoami)/Library/Android/sdk/emulator

 Step 4 ( Get all list of Advs  )
 emulator -list-avds

 Step 5 ( Run your Emulator Command Mode )
 emulator -avd Nexus_5_API_22_Android_5.1



回答2:


Take a look here : Android Emulator Error Message: "PANIC: Missing emulator engine program for 'x86' CPUS."

Then go as follows by cmd :

(the path to your emulators) - C:\Users\user\AppData\Local\Android\Sdk\emulator>

(the emulator name) - emulator.exe @Nexus_5 -dns-server 8.8.8.8 -writable-system



来源:https://stackoverflow.com/questions/54663606/run-android-emulator-using-command-line

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!