有没有一种方法可以在不启动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!
其他回答
在windows上
......\Android\sdk\tools\bin\avdmanager list avds
......\Android\sdk\tools\emulator.exe -avd Nexus_5X_API_27
在ANDROID_HOME文件夹中有一个tools文件夹
在Mac / Linux <avd > > 在Windows 模拟器。exe -avd <avdName>
如果你正在使用API 24,你可以从列表中获得模拟器的名称 Android列表avds 如果你正在使用API 25,那么你将在工具\bin中获得avdmanager Avdmanager列出avds
从控制台运行模拟器的方法(我假设你之前安装了它,使用Android Studio)是:
run
cd ~/Android/Sdk/tools/bin && ./avdmanager列表
OR
cd ~/Android/Sdk/tools && ./emulator -list-avds
您将获得虚拟安装设备的列表。我的情况是:
Available Android Virtual Devices:
Name: Galaxy_Nexus_API_17
Device: Galaxy Nexus (Google)
Path: /home/piotr/.android/avd/Galaxy_Nexus_API_17.avd
Target: Google APIs (Google Inc.)
Based on: Android 4.2 (Jelly Bean) Tag/ABI: google_apis/x86
Skin: galaxy_nexus
Sdcard: /home/piotr/.android/avd/Galaxy_Nexus_API_17.avd/sdcard.img
复制要运行的设备名称,然后
cd ~/Android/Sdk/tools && ./emulator -avd NAME_OF_YOUR_DEVICE . exe
在我的例子中:
cd ~/Android/Sdk/tools && ./emulator -avd Nexus_5X_API_23
更新:2020/05 Windows 10
首先获取一个模拟器列表,打开CMD并运行:
cd %homepath%\AppData\Local\Android\Sdk\emulator
then
emulator -list-avds
接下来在上面的目录中创建emulator.exe的快捷方式,然后通过编辑Target:文本框更改其中的属性,如下所示
模拟器。. exe @YourDevice
(仅适用于Windows) 为什么要折磨自己?制作一个简单的BAT文件!:
打开记事本 创建如下所示的命令 保存为*.bat (可选)创建*.bat的快捷方式,重命名快捷方式并更改图标
命令如下:
cd /d你的cd
例子:
cd /d d:\Android_SDK\emulator && emulator -avd Nexus_5_API_28