In reference to my previous question regarding making the .EXE file for demonstration
How to make .EXE for demonstration of a Android Software built in eclipse?
Can anyone explain creating batch file to lau开发者_如何学Cnch the emulator?
You can use the following code and save it as a batch file. All you need to do is swap out the "AVD_for_Nexus_6_by_Google" with one of your own emulators.
cd "%USERPROFILE%\AppData\Local\Android\sdk\tools" && .\emulator -avd AVD_for_Nexus_6_by_Google
If you want to see a list of all your installed emulators save and run the following in a batch file. The pause at the end is to make sure the window doesn't close when the command is complete.
cd "%USERPROFILE%\AppData\Local\Android\sdk\tools" && .\emulator -list-avds
pause
you can use the following command to launch the emulator
emulator -avd <avdname>
this assumes the path to emulator is set on your system
For run test from command prompt you can use @zair-naim answer
if you find error PANIC: Cannot find AVD system path. Please define ANDROID_SDK_ROOT
, just add ANDROID_SDK_ROOT to your Environment Variables
Open new Command Prompt and run again
- Create batch File "run_avd.bat" on Desktop or another place
- Edit and Add this line of code
cd "%USERPROFILE%\AppData\Local\Android\sdk\tools"
start emulator -avd Nexus5x
change Nexus5x with your avd name
- Save file and run batch file
You can use the below code and save it as a batch file.
cd C:\Users\user\AppData\Local\Android\Sdk\emulator && emulator -avd Nexus_5_API_28
create batch file for example Pixel2.bat
and enter following commands:
set PATH="D:\Android\Sdk\emulator"
emulator -avd Pixel_2_API_28
save the file. you can directly run emulator without opening android studio.
create batch file for example pixeldevice.bat
- open notepad
- put the following command
@Echo off
@Echo %cd%
C:
CD "C:\Users<may different>\AppData\Local\Android\Sdk\emulator"
@Echo %cd%
emulator -avd pixel2Emulator
Pause
- CD "C:\Users<may different>\AppData\Local\Android\Sdk\emulator" - navigate to emulator path
- @Echo %cd% -- display current path
- emulator -avd pixel2Emulator - run emulator
精彩评论