Android Emulator - Command Line Building - android

Back again on Stack needing help from fellow Android Developers. In my development environment im using a lot of command line building and management. Currently im running into a issue where the Terminal "Using Mac OSX" when executing the command "emulator -avd nameOfemulator" the Terminal is still live.
Example of Launching Emulator
However even when the emulator is open and live, The Terminal is not let go to be able to execute additional command, I dont want to just open a new tab or window to have to execute my adb command's. Currently i can closes the emulator and kill the live terminal/emulator command by a simple 'ctrl-C' however this defeats the purpose if the emulator is closed.
Does anybody know of anyway of getting the terminal live again, either through a script, string of commands, different type of emulator's, etc.
UPDATE
Now running the following command emulator -avd NexusSeven & This emulator has the HAX Intel Hardware Acceleration enabled. And shortly after the terminal becomes available again, The string "HAX is working and emulator runs in fast virt mode" is inputted into the command input and makes the terminal live again.

Since MacOSX is just a fork of BSD Linux, the emulator can be run in background by appending the ampersand:
emulator -avd NexusSeven &
To ignore all output, the following command will help:
emulator -avd NexusSeven > /dev/null 2>&1 &

Related

Run Android Emulator with Jenkins Pipeline on Windows

I am using a Android Emulator to run some tests where a need to send some information with adb commands so I created a Pipeline where the first stage is running the emulator with this command in the pipeline
bat 'emulator -avd Pixel_2_Test -no-window -no-audio wait-for-device'
When I use this command the job breaks, I think beacause is a daemon, so I tried to use start in the begin of the command to execut in backgroud, so in the next step I have:
bat 'adb devices'
I have this to see if the emulator is running but never return nothing, only never stop this step. I have to finished the job manually. I don't know if the emulator is really runing on background mode and I dont know why the adb command never stop. Please help me. I dont know how to run this emulator on the pipeline on Windows

Is it possible to run Espresso UI tests on -no-window emulator?

I'm trying to run my Espresso tests on CI (Jenkins in this case) server. I do not have access to the GUI over here so the approach I have decided on is using -no-window parameter on Android Emulator. Emulator starts fine however I receive Error: Could not access the Package Manager. Is the system running? error during installation process. So as I mentioned above, is there any way that I could run Espresso tests on non-gui machine? I know there is Jenkins plugin for Android Emulator but it seems to be outdated, last update is from 2015 I belive.. thanks!
I had the same problem with the running espresso tests on the emulator in the docker container. The problem occurred when I tried to run Activity.
Instrumental Unit Tests were working.
When I switched from x86_64 image to x86 tests pass. I run emulator using this command: emulator -avd Nexus6P -netdelay none -netspeed full -no-window -no-audio -gpu off
According to the internet (e.g. SO) you will get this error message if the emulator is not fully started or the device is locked.
You can try two things:
Send unlock keyevent to device (first check if device is online)
./adb devices
./adb shell input keyevent 82
Wait until device is fully started
./adb shell getprop init.svc.bootanim
// You should get "1" when ready
I currently have the exact same problem and sadly none of the above solutions is working for me. I guess the best way to identify the problem is to run the emulator with GUI to see what it is doing but I don't have access to the server.
Let me know if you can solve your problem.
Edit:
Also try to do a sleep for a few minutes (about 10 mins if your server isnt that fast) before calling
./adb install or ./gradlew connectedAndroidTest
Edit#2:
My emulator is finally working but had to use x86 images. Still no idea why arm is not working..

How to run Android emulator remotely

I have a android application that connects/send/receive to/from a server as part of its operation.
my final goal is to run this application on a number of android emulators on a remote machine(to save some computing resources on my laptop).
I SSHed to the remote machine and created the emulators remotely using android create avd -n AVD_xxx -t 1 .
I tried to run the emulators using emulator-arm -avd AVD_1 but it gave error that looks obvious : SDL init failure, reason is: No available video device
(if I run the command one the michine directly, it will run just fine)
I will appreciate if you help me solve this issue.
Note:
I don't need video provisions. is it possible to disable that by configuring AVD? this is just an example. you might have better solutions.
There are two options:
export $DISPLAY and show the emulator on some X display (tunneled or remotely existing)
run emulator -no-window [-no-audio] to start it without the need of a X display

How to open an android emulator and install an .apk at the same time from the same terminal?

I have a bizarre problem: I want to start an android emulator and at the same time install an already built .apk. The thing is that I want to do all these from the command line and especially from ONE terminal. (actually from a Makefile...).
If i start the emulator, it never stops until I close it thus I cannot execute any other command. On the other hand I don't know emulator's name before hand, although probably will be 5554.
Why not start the emulator in the background? From the command line, this is done by appending an ampersand to the command:
emulator -avd <whatever> &;
and then communicate with it via ADB:
adb install MyApp.apk

Android Debugging with Logcat and Emulator. Is it possible?

This is pretty simple: I'm using NetBeans on Linux with Android emulator 1.6. I have Logcat on my android phone, but the process of getting the messages to somewhere readable isn't smooth at all.
Can someone tell me how to get Logcat running on the emulator? Is there anything I can do to see debug messages other then having to copy the apk to my phone and testing it?
Thanks in advance!
You have a few options for viewing the debug log output, assuming you have the SDK installed and your command path set up correctly:
Type adb logcat. The log output from the connected device or running emulator will appear. I usually prefer adb logcat -v time to see the time stamps.
Type ddms. This launches the stand-alone version of DDMS. It has a logcat display at the bottom.
Install the ADT extension for Eclipse, and open the logcat view. (Since you're using NetBeans I assume this isn't what you want to do, but I'm mentioning it for completeness.)
In all cases, the interaction is the same whether you're using a physical device or software emulator, because the ADB daemon conceals the details. Whatever you're doing for the device is also expected to work for the emulator.
If you have a device and emulator connected simultaneously, you can use adb -e logcat for the emulator and adb -d logcat for the device. From stand-alone DDMS or Eclipse, just pick the device or emulator from the pop-up menu.
If you have setup nbandroid you can find the adb logcat viewer in netbeans under:
Window -> Output -> ADB Log
--edit
Just followed up on the post above and started using C:\Program Files (x86)\Android\android-sdk-windows\tools\ddms which is alot better then the one in netbeans.
The SDK comes with a handy tool called ddms it should be in the tools folder of the SDK.
At the moment an Emulator is running, or a mobile phone is connected to your machine it should show up in ddms and you can see all the log output in ddms.

Categories

Resources