当前位置: 首页 > 面试题库 >

Android仿真器在启动时未监听端口

吉岳
2023-03-14
问题内容

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=&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')

因此,“用户”用户一切正常,但对于“詹金斯”用户,我有问题

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安装有关,但是我不知道如何解决它。

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

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!因此,问题再次公开。


问题答案:

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

usermod -a -G libvirt jenkins


 类似资料:
  • 无法在仿真程序中启动AVD。 输出: 模拟器:警告:将VM堆大小设置为低于硬件指定的最小值128MB模拟器:警告:将VM堆大小设置为128MB qemu-system-i386.exe:-drive if=none,index=1,id=cache,file=c:\users\haris.android\avd\nexus_5_api_19.avd/cache.img:无法打开磁盘映像c:\use

  • 在我删除了一些旧的AVD并创建了一个新的之后,我无法启动任何AVD。如果我通过Android-Studio启动它们,AVD窗口会启动,但屏幕会一直黑屏,Android-Studio会停止响应。如果我使用以下命令通过命令行启动AVD: 行为是相同的,我在控制台中得到以下输出: 线。 我运行的是装有MacOS Big Sur Dev Beta的2017 MacBook Pro,但在删除旧AVDs之前,

  • 问题内容: 我想在php和jquery或ajax中编写一个“终端”模拟器。 我的意图不是执行真正的终端命令,我想执行echo等命令并将结果检索到TextArea,或者执行newuser之类的命令并打开一个jquery对话框或网页。有什么方法可以开发这个东西吗? 我想要的是在其中获得响应的文本区域以及在其中放置命令的文本输入字段。需要做的功能是调用一个php文件,在该文件中管理文本字段上的数据输入,

  • 我正在使用2.2.3 我使用创建了一个非常简单的项目。 当我运行项目时,在选项卡中出现以下错误: 那么该怎么做才能防止这种过程杀熟呢?

  • 问题内容: 我正在使用Jenkins,从昨天开始它已经停止工作。我看着Windows服务,它已被停止(以某种方式)。我重新启动了它,但此后它立即停止了。 我查看了从(C:\ Program Files \ Jenkins)运行服务的目录,并在其中打开了名为jenkins.out.log的日志文件。这就是它的意思 问题答案: 已修复- 适用于将来可能会遇到此问题的其他任何人。我用了这篇Techrep

  • 当我尝试通过Android Studio或cmd线(sudo./Monitor)启动Android设备监视器时,它会给我错误: 日志文件如下-https://gist.github.com/varadmondkar/fcaf9b726d56428108684c41aab2f1b3#file-1508905740386-log !entry org.eclipse.osgi 4 0 201 7-10