DeviceFarmer / stf

Control and manage Android devices from your browser.
https://devicefarmer.github.io
Other
3.47k stars 489 forks source link

Emulation Support #142

Open tomahawk3 opened 3 years ago

tomahawk3 commented 3 years ago

Hello,

I'm trying to use stf with emulated Android devices. Currently, I'm using QEMU.

I have read through the old project (OpenSTF) and noticed that emulation is not supported (even though some managed to get it to work). Have there been any updates for emulation support, or is there a way to get emulated android devices detected by stf?

My testing has been negative so far - stf didn't detect my QEMU android instance (I installed the stf version from the old GitHub repository using npm).

If emulation works, would it also be possible to run the emulator and stf on a headless Linux and display the GUI on the stf web app (if someone can manage to get this to work, I would also be paying for it but I'm not even sure if that's technically possible)?

I would be grateful for any information/ tips regarding emulation support.

koral-- commented 3 years ago

Official emulators are supported.

stf didn't detect my QEMU android instance

What is printed to the console?

If nothing it seems to be an issue with your ADB.

galek commented 3 years ago

@koral-- , Hello, my emulator is not recognized too

Official Android Emulator

Android 7.0 - API Level 24
Intel Atom (x86_64)
Hardware keyboard present
Skin with dynamic hardware controls
Front/Back cameras: emulated
Ram: 3072
VM Heap: 32
Internal Storage: 200
Emulation Options: SnapShot

command for launch: ./emulator -avd 'Nexus_6_a_7' -gpu off

What I do wrong?

koral-- commented 3 years ago

-gpu off have you tried without that option?

galek commented 3 years ago

This option only disables HW Acceleration. I can't try without this option (my GPU currently is not supported by fedora 33 and not had drivers).

denis99999 commented 3 years ago

@galek try this: emulator -avd Nexus_6_a_7 -no-window -accel off

galek commented 3 years ago

Hello @denis99999 , same result. I try to start the emulator from AVD and got a similar result.

galek commented 3 years ago

@denis99999 in #529 has a comment emulator -avd EM1 -no-window -gpu on So maybe it will be work.. but the emulator is not will start for me, so maybe I will try on the windows host using doker

Jim-Robbins commented 3 years ago

We have an AWS bare-metal instance on which we are hosting and stf-provider instance. Our setup uses the systemd+docker configuration, so we end up with adbd and stf-provider docker containers.

We were able to start up emulators and they were picked up by the instance. We use commands such as: setsid emulator @pixel_4_28_3 -netdelay none -netspeed full -no-boot-anim -writable-system -no-window

However, one issue we are seeing, is that any time we start a new emulator or reboot an existing one, it knocks our STF provider offline, as the emulator commands steal the adb daemon from the docker container. To get around this, we modified the adbd and provider .service files to auto restart and to issue an adb kill-server before the adbd service tries to start the container.

Any ideas on how to avoid this hack around?

denis99999 commented 3 years ago

@Jim-Robbins the idea would be to deport the emulator to a third machine and access it from your AWS bare-metal instance through the adb connect command?