Launch Android emulator on console (without graphic desktop ) - 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

Related

android studio only starts the virtual machine

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

emulator -avd does not launch the device

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

Nativescript - native emulator error when run android --emulator

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

How to run Android Emulator from Shell on Ubuntu Server

I installed Android SDK and JDK on Ubuntu Server 14.04 x64. But when I run the AVD, I got
error: 'SDL init failure, reason is: No available video device'
I follow this https://stackoverflow.com/a/6965679
sudo apt-get install ia32-libs
but didn't work.
Should I install any desktop on Ubuntu Server?
Try to run emulator without GUI following these steps:
From: http://paulemtz.blogspot.com/2013/05/android-testing-in-headless-emulator.html
Then, to run the headless emulator:
emulator -avd test -no-skin -no-audio -no-window
The '-no-skin' option removes the emulator buttons such as the home and other hardware keyboard buttons.
The '-no-audio' option disables the audio support.
Finally, the '-no-window' option disables the emulator's graphical window display.
Note that -avd test would need to be modified to refer to your specific emulator image (AVD).
You cannot run an emulator on the Server version of Ubuntu. The Emulator requires a GUI. Which the Server OS does not possess.
Rather use an Ubuntu Desktop OS
Then network your Server and Desktop, get the APK and upload it.
If you still wish to use Ubuntu Server with a GUI, refer to this, and repost the question with Ubuntu Server tags.

Android/Eclipse emulator how to wipe-data?

I got below errors while trying the above question . does anyone know what's going wrong?
$ adb devices
List of devices attached
emulator-5554 device
$ emulator -avd -wipe-data
PANIC: Could not open: -wipe-data
$ emulator -avd emulator-5554 -wipe-data
PANIC: Could not open: emulator-5554
Open command prompt,
android-sdk-windows\tools>emulator -avd -wipe-data
example-
emulator -avd androidavd2 -wipe-data
You can wipe data while starting emulator in ADT plugin, just mark checkbox:
So I know this question is a few years old. But I'm going to answer anyways because no answer has been accepted.
FIRST, make sure that (your-android-sdk-location)/tools is on your $PATH. It wouldn't hurt to verify this by using which emulator from the terminal. For example when I do this it outputs:
/Users/chris.w.newman/Library/Android/sdk/tools/emulator
SECOND, find where your AVDs are located. By default it is located in the .android/avd directory in your User account folder. So for me it is here:
/Users/chris.w.newman/.android/avd
THIRD, cd to the above directory and get the list of devices you have created by listing them with ls
chriswnewmans-MacBook-Pro:~ chris.w.newman$ cd /Users/chris.w.newman/.android/avd
chriswnewmans-MacBook-Pro:avd chris.w.newman$ ls
Nexus_5_API_19.avd Nexus_5_API_19.ini
Note that every device has a pair of results, an .avd folder and an .ini file. You can see that I have one device whose name is Nexus_5_API_19.
FOURTH, to wipe the data of the device from the terminal you use the emulator -wipe-data command. Some people might find this annoying because it will ALSO launch the emulator after it finishes wiping the data. Anyways here's how you do it:
emulator -avd Your_Device_Name -wipe-data
The main reason I find this approach to wiping data annoying is that now the emulator is running from the terminal. That means if I wanted to do more work in the terminal, I would either need to open another terminal (I hate having multiple terminals open), or close my emulator to free up the terminal.
For completeness sake, I will mention that you can wipe the data of an emulator from the AVD manager (at least the one that is built into Android Studio). Open the AVD manager and in the list of devices, all the way on the right hand side you click the dropdown arrow and select Wipe Data. This wipes the data without launching the emulator.
I have Windows10 and using Android Studio 3.4
Follow the steps:
Tools -> AVD Manager -> Right Most Button under Actions(Down triangle Icon) -> Wipe Data
This image shows the steps in a screenshot.
Try:
emulator -list-avds
EMULATOR_NAME will be displayed
emulator -avd EMULATOR_NAME -wipe-data
Example:
emulator -list-avds
Pixel_XL_API_29
emulator -avd Pixel_XL_API_29 -wipe-data

Categories

Resources