Jenkins无法运行android模拟器。
[android] Using Android SDK: /opt/android-sdk-linux [android] Creating Android AVD: /var/lib/jenkins/.android/avd/hudson_en-US_240_WVGA_android-23_google_apis-x86_64.avd [android] /opt/android-sdk-linux/tools/android create avd -f -a -s WVGA800 -n hudson_en-US_240_WVGA_android-23_google_apis-x86_64 -t android-23 --abi google_apis/x86_64 $ /opt/android-sdk-linux/platform-tools/adb start-server * daemon not running. starting it now at tcp:5837 * * daemon started successfully * $ /opt/android-sdk-linux/platform-tools/adb start-server [android] Starting Android emulator $ /opt/android-sdk-linux/tools/emulator -engine classic -ports 5682,5683 -report-console tcp:5827,max=60 -prop persist.sys.language=en -prop persist.sys.country=US -avd hudson_en-US_240_WVGA_android-23_google_apis-x86_64 -no-snapshot-load -no-snapshot-save -no-window WARNING: Force to use classic engine to support snapshot. [android] Emulator did not appear to start; giving up [android] Stopping Android emulator $ /opt/android-sdk-linux/platform-tools/adb kill-server Finished: NOT_BUILT
然后,我尝试与jenkins一样运行模拟器。问题是android模拟器没有开始监听端口。首先,我以“用户”用户成功创建并启动了模拟器,如下所示:
user@host:~$android create avd -f -a -s WVGA800 -n test -t android-23 --abi google_apis/x86_64 Android 6.0 is a basic Android platform. Do you wish to create a custom hardware profile [no]no Created AVD 'test' based on Android 6.0, Google apis Intel Atom (x86_64) processor, with the following hardware config: hw.lcd.density=240 hw.ramSize=512 vm.heapSize=48 user@host:~$ emulator -avd test -no-snapshot-load -no-snapshot-save -no-window WARNING: Force to use classic engine to support snapshot. emulator: WARNING: Classic qemu does not support SMP. The hw.cpu.ncore option from your config file is ignored. Creating filesystem with parameters: Size: 69206016 Block size: 4096 Blocks per group: 32768 Inodes per group: 4224 Inode size: 256 Journal blocks: 1024 Label: Blocks: 16896 Block groups: 1 Reserved block group size: 7 Created filesystem with 11/4224 inodes and 1302/16896 blocks emulator: Listening for console connections on port: 5554 emulator: Serial number of this emulator (for ADB): emulator-5554 [139763360147200]:WARNING:./android/base/files/IniFile.cpp:158:Failed to process .ini file /home/user/.android/emu-update-last-check.ini for reading. emulator: WARNING: UpdateCheck: Failure: No error none.xml:1: parser error : Extra content at the end of the document amp;uid=&os=Linuxversion=25.2.5.0&coreVersion=qemu1%200.10.50">Found</a> ^ emulator: WARNING: UpdateCheck: failed to get the latest version, skipping check (current version '25.2.5-3567187')
因此,“用户”用户一切正常,但对于“詹金斯”用户,我有问题
jenkins@host:~$ android create avd -f -a -s WVGA800 -n test -t android-23 --abi google_apis/x86_64 Android 6.0 is a basic Android platform. Do you wish to create a custom hardware profile [no]no Created AVD 'test' based on Android 6.0, Google apis Intel Atom (x86_64) processor, with the following hardware config: hw.lcd.density=240 hw.ramSize=512 vm.heapSize=48 jenkins@host:~$ emulator -avd test -no-snapshot-load -no-snapshot-save -no-window WARNING: Force to use classic engine to support snapshot. emulator: WARNING: Classic qemu does not support SMP. The hw.cpu.ncore option from your config file is ignored. Creating filesystem with parameters: Size: 69206016 Block size: 4096 Blocks per group: 32768 Inodes per group: 4224 Inode size: 256 Journal blocks: 1024 Label: Blocks: 16896 Block groups: 1 Reserved block group size: 7 Created filesystem with 11/4224 inodes and 1302/16896 blocks
就是这样!不管我等待了多少时间,“仿真器:在端口5554上监听控制台连接”这一行都不到了!
顺便说一句,kvm对两个用户都运行良好
$ kvm-ok INFO: /dev/kvm exists KVM acceleration can be used
同样,“ ANDROID_HOME”和“ HOME”环境参数也不错。
有什么建议吗?
更新
我注意到使用google_apis/armeabi-v7aabi 时不会发生此问题。所以我相信这个问题与kvm安装有关,但是我不知道如何解决它。
google_apis/armeabi-v7a
jenkins@hosst:~$ android create avd -f -a -s WVGA800 -n test -t android-23 --abi google_apis/armeabi-v7a Android 6.0 is a basic Android platform. Do you wish to create a custom hardware profile [no]no Created AVD 'test' based on Android 6.0, Google apis ARM (armeabi-v7a) processor, with the following hardware config: hw.lcd.density=240 hw.ramSize=512 vm.heapSize=48 jenkins@host:~$ emulator -avd test -no-window WARNING: Force to use classic engine to support snapshot. emulator: WARNING: System image is writable emulator: WARNING: Classic qemu does not support SMP. The hw.cpu.ncore option from your config file is ignored. [140306725234432]:WARNING:./android/base/files/IniFile.cpp:158:Failed to process .ini file /var/lib/jenkins/.android/avd/test.avd/snapshots.img.default-boot.ini for reading. Creating filesystem with parameters: Size: 69206016 Block size: 4096 Blocks per group: 32768 Inodes per group: 4224 Inode size: 256 Journal blocks: 1024 Label: Blocks: 16896 Block groups: 1 Reserved block group size: 7 Created filesystem with 11/4224 inodes and 1302/16896 blocks emulator: Listening for console connections on port: 5554 emulator: Serial number of this emulator (for ADB): emulator-5554 [140306725234432]:WARNING:./android/base/files/IniFile.cpp:158:Failed to process .ini file /var/lib/jenkins/.android/emu-update-last-check.ini for reading. emulator: WARNING: UpdateCheck: Failure: No error none.xml:1: parser error : Extra content at the end of the document amp;uid=&os=Linuxversion=25.2.5.0&coreVersion=qemu1%200.10.50">Found</a> ^ emulator: WARNING: UpdateCheck: failed to get the latest version, skipping check (current version '25.2.5-3567187')
更新#2 在成功运行模拟器并将答案发布到下面之后,我又陷入了这个问题!并且我的解决方案不再起作用了:(顺便说一句,我在这里找到了另一个要与您共享的线索。以下命令并未像我之前提到的那样开始监听端口
android-sdk-linux/tools/emulator -avd test -no-snapshot-load -no-snapshot-save -no-window
但令人惊讶的是,该命令运行良好
android-sdk-linux/tools/qemu/linux-x86_64/qemu-system-x86_64 -avd test -no-snapshot-load -no-snapshot-save -no-window
我猜emulator应该运行,qemu- system-x86_64但是在某些地方会出错并emulator64-x86改为运行。发现此事件后,我无法弄清楚如何输入此命令Android Emulator plugin!因此,问题再次公开。
emulator
qemu- system-x86_64
emulator64-x86
Android Emulator plugin
从我的更新中,我有一些线索表明此问题与kvm安装有关。另一方面,我注意到user用户libvirt是与kvm权限相关的组的成员。因此,我将jenkins用户添加到libvirt组并爆炸!问题解决了。
user
libvirt
jenkins
usermod -a -G libvirt jenkins