我正在尝试在Jenkins CI上启动Android模拟器,但启动从未完成。在CI上,该命令在基于ubuntu:18.04
的Docker映像中运行。我正在使用以下命令来启动模拟器:
/opt/android-sdk-linux/emulator/emulator -no-audio -no-window -delay-adb \
@Pixel_C_API_25 &
然后我等待模拟器完成:
adb wait-for-device
在我的开发人员机器(macOS 10.14.6)上,仿真器完成启动并返回adb wait-for-device
,但是在CI上,仿真器从未完成启动。日志输出的相关部分在这里:
Starting emulator
Waiting for emulator
* daemon not running; starting now at tcp:5037
statvfs('/home/ec2-user/.android/avd/Pixel_C_API_25.avd/snapshots/default_boot/ram.img') failed: No such file or directory
### WARNING: could not find /usr/share/zoneinfo/ directory. unable to determine host timezone
emulator: WARNING: encryption is off
Your emulator is out of date, please update by launching Android Studio:
- Start Android Studio
- Select menu "Tools > Android > SDK Manager"
- Click "SDK Tools" tab
- Check "Android Emulator" checkbox
- Click "OK"
* daemon started successfully
### WARNING: could not find /usr/share/zoneinfo/ directory. unable to determine host timezone
Sending interrupt signal to process
Terminated
script returned exit code 143
我认为“模拟器已过时”警告是一条红鲱鱼,因为它不会对我造成局部问题。我认为更可能的问题是:
statvfs('/home/ec2-user/.android/avd/Pixel_C_API_25.avd/snapshots/default_boot/ram.img') failed: No such file or directory
但是我无法找到导致此问题或解决此问题的信息。本地ram.img
文件存在。
我已尝试根据以下系统映像使用AVD。以前,x86相关的映像上不支持x86,这似乎是一个错误,但是我不再遇到该错误。而是,所有这些都给了上面的ram.img
错误:
system-images;android-25;google_apis;arm64-v8a
system-images;android-25;google_apis;armeabi-v7a
system-images;android-28;google_apis;x86_64
system-images;android-28;google_apis;x86
system-images;android-28;default;x86_64
在每种情况下,我都使用类似于以下内容的命令创建AVD:
sdkmanager --install "system-images;android-25;google_apis;armeabi-v7a"
avdmanager create avd --force --name Pixel_C_API_25 --abi google_apis/armeabi-v7a --package "system-images;android-25;google_apis;armeabi-v7a" --device "pixel_c"
是否有人成功获得了可在Ubuntu 18上启动的Android模拟器,如果是,您使用了哪个系统映像?