When I recently studied React Native, I needed to use an emulator to test (when I don’t need a mobile phone to run).But every time you have to start Android Studio and then start the emulator, it is very troublesome to operate twice,
You can start your emulator by using command line, by open your CMD in your sdk folder / emulator. Then try this command
emulator -list-avds
To list your virtual devices and then
emulator -avd <device_name>
You can find the detail here
https://developer.android.com/studio/run/emulator-commandline#starting
Hope that help. ^^
You can start emulators from the terminal/ CMD without opening Android Studio.
To get the list of AVDs (run from sdk/emultor folder)
emulator -list-avds
To run any avd
emulator -avd avd_name [ {-option [value]} … ]
or,
/Users/janedoe/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_23 -netdelay none -netspeed full
For more details refer - Official guide
Related
I'm setting up a Flutter environment and all except my emulator isn't working.
I'm using Android Studio 3.6.2
This is the setup for the emulator in AVD:
Virtualization is enabled and HAXM is installed
When launching the emulator it only gets to about where the red square is, then does nothing and returns to the virtual devices list:
Also tried launching it with flutter itself by command line and in VS Code with no luck:
And I don't get any error messages.
Anyone know where to go from here?
Thanks.
After creating AVD from android studio. Open Command Prompt and execute this command.
C:\Path_to_Android_Sdk\sdk\tools\emulator.exe -netdelay none -netspeed full -avd YOUR_AVD_DEVICE_NAME
I am trying run appium test case on android emulator,but there is a confusing situation.
The test case will start a specified activity, is very fast on the android emulator from avd manager(5-6s).
avd manager:
avd manager
The android emulator from command line is also relatively smooth,but the test case start the specified activity very slow(20-30s).It can fast infrequently(1%-2%).
command line:
emulator -avd Nexus_5_API_27
The avd is same.So,is there any difference between the same avd from command line and from avd manager ?
I've tried a lot of acceleration options but they don't work.
When you open emulator from avd then it opens using commandline itself but with some startup options. Following command is executed when you run emulator from avd
emulator -avd Nexus_5X_API_21 -netdelay none -netspeed full
Try to include these options in your command line instead of normal run. You can run your command like this:
emulator -avd Nexus_5_API_27 -netdelay none -netspeed full
i hope it will help you.
on Ubuntu 16.04 I have installed AndroidStudio and via its AVD manager GUI did create tow new devices. now on Terminal when I type emulator -list-avds it lists the devices correctly, but when run emulator -avd <name> I face errors:
[139684796983104]:ERROR:android/android-emu/android/qt/qt_setup.cpp:28:Qt library not found at ../emulator/lib64/qt/lib
Could not launch '/home/amir/../emulator/qemu/linux-x86_64/qemu-system-i386': No such file or directory
How should I solve it?
both in Windows 10 and Ubuntu I was facing the same problem. the simple solution is that I had to go to the directory of tools then execute the command. for instance in windows.
$ cd C:\Users\user-name\AppData\Local\Android\sdk\tools
emulator -avd <deviceName>
also it is good to mention I wanted that for React-Native development, and Expo XDE saved me
I receive the following error when I run android --emulator on my cmd;
Cannot run your app in the native emulator. Increase the timeout of the operation with the --timeout option or try to restart your adb server with 'adb kill-server' command. Alternatively, run the Android Virtual Device manager and increase the allocated RAM for the virtual device.
I've opened it with administrator rights and ran all the tutorials on the website.
I'm now stuck at this point and haven't been able to find the solution.
I've also tried tns run android --emulator --timeout -0 and waited for an hour without result.
What can i do to get the emulator running?
I had the same problem, I solved by opening avd manager and try starting the virtual device(emulator) you created. If the emulator doesnt launches, you will get an error in the console.
For me I had to install the intel HAXM, for launching the emulator
You just need to open your Android Virtual Device Manager and download
the latest emulator. Then run your application again.It will work.
tns run android
Runs the Emulator and then run the app on it.
Sometimes both process can't happen at once, admin access in Linux can be such case.
try starting the Emulator first then the app.
emulator -avd avd_name [ {-option [value]} … ]
for example:
sudo $ANDROID_HOME/emulator/emulator -avd test -netdelay none -netspeed full
'sudo' is important for Linux users.
then use this to start the app.
tns run android
I'm trying to run android emulator on terminal I have downloaded android sdk on VM ubuntu server (Thus I dont have graphic desktop, only terminal console).
I want to run emulator on terminal as a service that I can use for install App and run some tests(battery consumption, install, others).
I want to create some AVD and run test scripts on it.
But, I cant launch emulator without graphic desktop. Is it possible?
I find that it's possible start Android Emulator without graphic with this command:
$emulator -avd <avd_name> -no-window
Also you can add other commands to clean data on emulator
$emulator -avd <avd_name> -no-window -wipe-data