HydraLab
HydraLab copied to clipboard
Explore the docker Android Emulator
Pull Request Checklist
- [ ] Tests for the changes have been added (for bug fixes / features)
- [x] Code compiles correctly with all tests are passed.
- [x] I've read the contributing guide and followed the recommended practices.
- [ ] Wikis or README have been reviewed and added / updated if needed (for bug fixes / features)
Does this introduce a breaking change?
If this introduces a breaking change for Hydra Lab users, please describe the impact and migration path.
- [ ] Yes
- [x] No
Pull Request Description
Please check the type of change your PR introduces:
- [ ] Bugfix
- [x] Feature
- [x] Build related changes
- [ ] Refactoring (no functional changes, no api changes)
- [ ] Code style update (formatting, renaming) or Documentation content changes
- [ ] Other (please describe):
A few words to explain your changes: We attempt to start an Android emulator in the docker container so that when the agent is started, we will have a initial Android emulator phone available.
Issue ID: #
How you tested it
Please make sure the change is tested, you can test it by adding UTs, do local test and share the screenshots, etc.
Feature UI screenshots or Technical design diagrams
If this is a relatively large or complex change, kick it off by drawing the tech design with PlantUML and explaining why you chose the solution you did and what alternatives you considered, etc...
Updated, current status:
- Emulator can be created and enabled before agent starts.
- ADB host for emulator is different from the one for real phone devices of PC.
- TODO: multiple adb servers should be enabled to support this scenario.
- TODO: when set ADB host to localhost to enable emulator connection, adb commands within agent will fail.
Update, current status for emulator startup in Docker (based on OS architecture):
- x86/x86_64的模拟器不能跑 (需要硬件加速)
# apt-get install cpu-checker
# kvm-ok
INFO: Your CPU does not support KVM extensions
KVM acceleration can NOT be used
# egrep -c '(vmx|svm)' /proc/cpuinfo
0 (means no CPU for hardware acceleration)
-
arm64最高支持Android API 27:https://stackoverflow.com/questions/74760054/panic-avds-cpu-architecture-arm64-is-not-supported-by-the-qemu2-emulator-on
- arm版本的emulator命令可以执行成功,但无法正常启动,因此adb 命令跑不起来。影响:
- 无法截图
- 由于第一点,导致影响后续test running
- arm版本的emulator命令可以执行成功,但无法正常启动,因此adb 命令跑不起来。影响:
-
TODO: Currently only possible available solution (uninvestigated):
- 本地debug: 需要在环境中模拟ARM64构建Docker镜像。具体方案如下:
- 在Windows/Docker中启动QEMU,模拟ARM64,然后构建Docker 镜像
- 在此环境中创建安卓模拟器,看是否可以正常启动,并执行adb命令
- 需要提供的sample app & test app也为ARM64架构的。
- Release pipeline中使用的ADO agent为x86_64架构 (https://dlwteam.visualstudio.com/Next/_releaseProgress?_a=release-environment-logs&releaseId=3230&environmentId=21480)
- 构建方式需和本地debug一致,较为复杂。
- 本地debug: 需要在环境中模拟ARM64构建Docker镜像。具体方案如下:
According to the following section, we may not proceed this item in current context:
- https://github.com/budtmo/docker-android/blob/master/README.md
- For our azure pipeline, the output of precedent commands shows KVM is not supported either.
- https://dlwteam.visualstudio.com/Next/_releaseProgress?releaseId=3230&_a=release-environment-logs&environmentId=21480
