Android仿真器在启动时未监听端口 [英] Android emulator is not listening to port while starting

查看:466
本文介绍了Android仿真器在启动时未监听端口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Jenkins无法运行android模拟器.

Jenkins cannot run an android emulator.

[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模拟器没有开始监听端口.首先,我与用户"用户一起成功创建并启动了模拟器,如下所示:

Then, I try to run emulator the same as jenkins. The problem is android emulator is not starting to listen to the port. First, I created and started emulator successfully with the 'user' user as follow:

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=&amp;os=Linuxversion=25.2.5.0&amp;coreVersion=qemu1%200.10.50">Found</a>
                                                                               ^
emulator: WARNING: UpdateCheck: failed to get the latest version, skipping check (current version '25.2.5-3567187')

所以'user'用户一切正常,但是对于'jenkins'用户我有问题

So everything is okey with 'user' user, but for 'jenkins' user I have problem

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上监听控制台连接"这一行都没来!

and that is it! No matter how much I wait the line of "emulator: Listening for console connections on port: 5554" is not coming!

顺便说一句,kvm对两个用户都运行正常

BTW, kvm is running okey for both users

$ kvm-ok
INFO: /dev/kvm exists
KVM acceleration can be used

此外,"ANDROID_HOME"和"HOME"环境参数都很好.

Also, "ANDROID_HOME" and "HOME" environment parameters are okey.

有什么建议吗?

更新

我注意到当我使用google_apis/armeabi-v7a abi时不会发生此问题.所以我相信这个问题与kvm的安装有关,但是我不知道如何解决它.

I noticed this problem is not happening when I'm using google_apis/armeabi-v7a abi. So I believe this problem is related to kvm installation, but I have not idea how to fix it.

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=&amp;os=Linuxversion=25.2.5.0&amp;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 成功运行模拟器并将答案发布到下面之后,我又陷入了这个问题!!并且我的解决方案不再起作用了:(顺便说一句,我在这里找到了另一个要与您共享的线索.以下命令并未像我之前提到的那样开始监听该端口

UPDATE #2 After I successfully run the emulator and post my answer below, I fall to this problem again!! and my solution is not working anymore :( BTW I found another clue that I want to share it with you here. Following command is not starting to listen to the port as I mentioned before

android-sdk-linux/tools/emulator -avd test -no-snapshot-load -no-snapshot-save -no-window

但是令人惊讶的是,该命令正在运行okey

But surprisingly, this command is running okey

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中放置此命令!因此问题再次出现.

I guess emulator should run qemu-system-x86_64 but somewhere it makes some mistakes and run emulator64-x86 instead. Event after this finding I cannot figure out how to put this command in Android Emulator plugin! So the question is open again.

推荐答案

从我的更新中,我有一些线索表明此问题与kvm安装有关.我正在使用此帖子安装kvm.另一方面,我注意到user用户是libvirt组的成员,该组与kvm权限有关.所以我将jenkins用户添加到libvirt组并爆炸!问题解决了.

From my update I had some clues that this problem is related to kvm installation. I was using this post to install kvm. On the other hand, I noticed user user is a member of libvirt group which is related to kvm permissions. So I add jenkins user to libvirt group and bang! the problem solved.

usermod -a -G libvirt jenkins

这篇关于Android仿真器在启动时未监听端口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆