有没有一种方法可以在不启动Android Studio的情况下运行模拟器。也许是从命令行。我知道这个功能在旧版本中是可用的,但从那以后就消失了。但也许有人已经知道怎么做了?
当前回答
只需创建一个.bat文件。叫它smth,比如run pixel 2.bat 用notepad++这样的编辑器打开它 写2行代码
cd C:\Users\mxsof\AppData\Local\Android\Sdk\emulator
emulator -avd pixel_2_api_29
启动它。
这是所有。编码快乐!
其他回答
你可以创建一个shell脚本并把它放在你的桌面:
Dim WinScriptHost
Set WinScriptHost = CreateObject("WScript.Shell")
WinScriptHost.Run "C:\Users\<user>\AppData\Local\Android\Sdk\emulator\emulator -avd <AVD_NAME>", 0
Set WinScriptHost = Nothing
用你的用户id替换<user>,用你的avd文件的名字替换<AVD_NAME>,例如pixel_2_api_28。
如果您正在启动Flutter应用程序的模拟器,则可以运行以下命令-
> flutter emulators --launch [Emulator ID]
在我的例子中,模拟器id是Pixel_2_API_29,因为我在Android studio中使用AVD管理器创建了它。这里的命令是-
> flutter emulators --launch Pixel_2_API_29
谢谢
在windows上
......\Android\sdk\tools\bin\avdmanager list avds
......\Android\sdk\tools\emulator.exe -avd Nexus_5X_API_27
我正在做一个React Native项目,我也遇到了这个问题
我在桌面上制作了一个可以快速打开的.bat文件,解决了这个问题
.bat文件的内容是
C:\Users\haria\AppData\Local\Android\sdk\emulator\emulator -avd Pixel_2_XL_API_27
haria是我的Windows用户名和 Pixel_2_XL_API_27是我的模拟器名称
如果您想查看模拟器名称,请打开CMD(或PowerShell)并键入(在Windows中)
cd C:\Users\haria\AppData\Local\Android\sdk\emulator
然后查看模拟器的名称
。/模拟器-list-avds
你可以制作一个批处理文件,这将直接打开模拟器,而不需要打开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!