有没有一种方法可以在不启动Android Studio的情况下运行模拟器。也许是从命令行。我知道这个功能在旧版本中是可用的,但从那以后就消失了。但也许有人已经知道怎么做了?
当前回答
你可以制作一个批处理文件,这将直接打开模拟器,而不需要打开Android Studio。如果你使用的是Windows:
Open Notepad New file Copy the next lines into your file: cd /d C:\Users\%username%\AppData\Local\Android\sdk\tools emulator @[YOUR_EMULATOR_DEVICE_NAME] Notes: Replace [YOUR_EMULATOR_DEVICE_NAME] with the device name you created in emulator To get the device name go to: C:\Users\%username%\AppData\Local\Android\sdk\tools Run cmd and type: emulator -list-avds Copy the device name and paste it in the batch file Save the file as emulator.bat and close Now double click on emulator.bat and you got the emulator running!
其他回答
你可以制作一个批处理文件,这将直接打开模拟器,而不需要打开Android Studio。如果你使用的是Windows:
Open Notepad New file Copy the next lines into your file: cd /d C:\Users\%username%\AppData\Local\Android\sdk\tools emulator @[YOUR_EMULATOR_DEVICE_NAME] Notes: Replace [YOUR_EMULATOR_DEVICE_NAME] with the device name you created in emulator To get the device name go to: C:\Users\%username%\AppData\Local\Android\sdk\tools Run cmd and type: emulator -list-avds Copy the device name and paste it in the batch file Save the file as emulator.bat and close Now double click on emulator.bat and you got the emulator running!
这是Mac上的命令
cd ~/Library/Android/Sdk/tools/bin && ./avdmanager list avd
then
cd ~/Library/Android/Sdk/tools && ./emulator -avd NAME_OF_YOUR_DEVICE
只需创建一个.bat文件。叫它smth,比如run pixel 2.bat 用notepad++这样的编辑器打开它 写2行代码
cd C:\Users\mxsof\AppData\Local\Android\Sdk\emulator
emulator -avd pixel_2_api_29
启动它。
这是所有。编码快乐!
打开终端,然后
cd path_to/Android/Sdk/emulator
并运行以下命令来获取您在使用android studio之前创建的模拟器名称
./emulator -list-avds
将$emulator_name替换为您想要启动和运行的
./emulator -avd $emulator_name
(仅适用于Windows) 为什么要折磨自己?制作一个简单的BAT文件!:
打开记事本 创建如下所示的命令 保存为*.bat (可选)创建*.bat的快捷方式,重命名快捷方式并更改图标
命令如下:
cd /d你的cd
例子:
cd /d d:\Android_SDK\emulator && emulator -avd Nexus_5_API_28