运行 Android 模拟器 - 分段错误

问题描述 投票:0回答:2

我想在无 GUI 的 CentOS Linux 上以无头模式运行 Android 模拟器。运行时出现segmentation failure错误。看来模拟器在系统重启后只运行一次,之后我就无法运行它了。当模拟器开始代理数据时失败。

我期望在无头模式下运行 android 模拟器并对其执行自动化测试。

创建模拟器的指令:

./avdmanager create avd -n pixel_xl -k "system-images;android-28;google_apis;x86_64" -d "pixel_xl" 

运行模拟器的说明:

./emulator-headless -avd pixel_xl -verbose -wipe-data -no-snapshot-save -gpu off 

./emulator -avd pixel_xl -verbose -wipe-data -no-snapshot-save -no-audio -no-window 

日志:

emulator: Android emulator version 29.0.11.0 (build_id 5598178) (CL:N/A)
emulator: Found AVD name 'pixel_xl'
emulator: Found AVD target architecture: x86_64
emulator: Deleting file /root/.android/avd/pixel_xl.avd/system.img.qcow2 failed
emulator: Deleting file /root/.android/avd/pixel_xl.avd/vendor.img.qcow2 failed
emulator: Deleting file /root/.android/avd/pixel_xl.avd/userdata-qemu.img done
emulator: Deleting file /root/.android/avd/pixel_xl.avd/userdata-qemu.img.qcow2 failed
emulator: Deleting file /root/.android/avd/pixel_xl.avd/userdata.img failed
emulator: Deleting file /root/.android/avd/pixel_xl.avd/userdata.img.qcow2 failed
emulator: Deleting file /root/.android/avd/pixel_xl.avd/cache.img done
emulator: Deleting file /root/.android/avd/pixel_xl.avd/cache.img.qcow2 failed
emulator: Deleting file /root/.android/avd/pixel_xl.avd/version_num.cache failed
emulator: Deleting file /root/.android/avd/pixel_xl.avd/sdcard.img.qcow2 failed
emulator: Deleting file /root/.android/avd/pixel_xl.avd/encryptionkey.img done
emulator: Deleting file /root/.android/avd/pixel_xl.avd/encryptionkey.img.qcow2 failed
emulator: Deleting file /root/.android/avd/pixel_xl.avd/hardware-qemu.ini failed
emulator: Deleting file /root/.android/avd/pixel_xl.avd/emulator-user.ini failed
emulator: Deleting file /root/.android/avd/pixel_xl.avd/default.dtb failed
emulator: Failed to remove snapshot directory '/root/.android/avd/pixel_xl.avd/snapshots'
emulator: Removed ADB command directory '/root/.android/avd/pixel_xl.avd/tmpAdbCmds'
emulator: argv[0]: './emulator-headless'; program directory: '/opt/software/sdks/android/sdk/emulator'
emulator:  Found directory: /opt/software/sdks/android/sdk/system-images/android-28/google_apis/x86_64/

emulator: emuDirName: '/opt/software/sdks/android/sdk/emulator'
emulator: try dir /opt/software/sdks/android/sdk/emulator
emulator: Trying emulator path '/opt/software/sdks/android/sdk/emulator/qemu/linux-x86_64/qemu-system-x86_64-headless'
emulator: Found target-specific 64-bit emulator binary: /opt/software/sdks/android/sdk/emulator/qemu/linux-x86_64/qemu-system-x86_64-headless
emulator: Adding library search path: '/opt/software/sdks/android/sdk/emulator/lib64'
emulator: Adding library search path: '/opt/software/sdks/android/sdk/emulator/lib64/gles_swiftshader'
emulator: Adding library search path: '/opt/software/sdks/android/sdk/emulator/lib64/gles_angle'
emulator: Adding library search path: '/opt/software/sdks/android/sdk/emulator/lib64/gles_angle9'
emulator: Adding library search path: '/opt/software/sdks/android/sdk/emulator/lib64/gles_angle11'
emulator: Adding library search path: '/opt/software/sdks/android/sdk/emulator/lib64/libstdc++'
emulator: Running :/opt/software/sdks/android/sdk/emulator/qemu/linux-x86_64/qemu-system-x86_64-headless
emulator: qemu backend: argv[00] = "/opt/software/sdks/android/sdk/emulator/qemu/linux-x86_64/qemu-system-x86_64-headless"
emulator: qemu backend: argv[01] = "-avd"
emulator: qemu backend: argv[02] = "pixel_xl"
emulator: qemu backend: argv[03] = "-verbose"
emulator: qemu backend: argv[04] = "-wipe-data"
emulator: qemu backend: argv[05] = "-no-snapshot-save"
emulator: qemu backend: argv[06] = "-gpu"
emulator: qemu backend: argv[07] = "off"
emulator: Concatenated backend parameters:
 /opt/software/sdks/android/sdk/emulator/qemu/linux-x86_64/qemu-system-x86_64-headless -avd pixel_xl -verbose -wipe-data -no-snapshot-save -gpu off
emulator: autoconfig: -skin 1440x2560
emulator: autoconfig: -skindir (null)
emulator: autoconfig: -kernel /opt/software/sdks/android/sdk/system-images/android-28/google_apis/x86_64//kernel-ranchu
emulator: Target arch = 'x86_64'
emulator: Auto-detect: Kernel image requires new device naming scheme.
emulator: Auto-detect: Kernel does not support YAFFS2 partitions.
emulator: autoconfig: -ramdisk /opt/software/sdks/android/sdk/system-images/android-28/google_apis/x86_64//ramdisk.img
emulator: Using initial system image: /opt/software/sdks/android/sdk/system-images/android-28/google_apis/x86_64//system.img
emulator: Using initial vendor image: /opt/software/sdks/android/sdk/system-images/android-28/google_apis/x86_64//vendor.img
emulator: autoconfig: -initdata /opt/software/sdks/android/sdk/system-images/android-28/google_apis/x86_64//userdata.img
emulator: autoconfig: -cache /root/.android/avd/pixel_xl.avd/cache.img
emulator: Increasing RAM size to 1536MB
emulator: VM heap size 0MB is below hardware specified minimum of 384MB,setting it to that value
emulator: System image is read only
emulator: Found 3 DNS servers: 192.44.120.10 137.183.226.11 143.26.128.29
emulator: found magic skin width=1440 height=2560 bpp=16

emulator: registered 'boot-properties' qemud service
emulator: Adding boot property: 'qemu.cmdline' = 'androidboot.logcat=v:* androidboot.consolepipe=qemu_pipe,pipe:logcat'
emulator: Adding boot property: 'qemu.logcat' = 'start'
emulator: Creating ext4 userdata partition: /root/.android/avd/pixel_xl.avd/data
Creating filesystem with parameters:
    Size: 838860800
    Block size: 4096
    Blocks per group: 32768
    Inodes per group: 7328
    Inode size: 256
    Journal blocks: 3200
    Label:
    Blocks: 204800
    Block groups: 7
    Reserved block group size: 55
Created filesystem with 61/51296 inodes and 10842/204800 blocks
emulator: Creating empty ext4 cache partition: /root/.android/avd/pixel_xl.avd/cache.img
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: CPU Acceleration: working
emulator: CPU Acceleration status: KVM (version 12) is installed and usable.
emulator: VERBOSE: AdbInterface.cpp:232: Found: 3 adb executables
emulator: VERBOSE: AdbInterface.cpp:234: Adb: /opt/software/sdks/android/sdk/platform-tools/adb
emulator: VERBOSE: AdbInterface.cpp:234: Adb: /opt/software/sdks/android/sdk/platform-tools/adb
emulator: VERBOSE: AdbInterface.cpp:234: Adb: /opt/software/sdks/android/sdk/platform-tools/adb
emulator: VERBOSE: AdbInterface.cpp:253: Path:/opt/software/sdks/android/sdk/platform-tools/adb protocol version: 41
emulator: VERBOSE: AdbInterface.cpp:253: Path:/opt/software/sdks/android/sdk/platform-tools/adb protocol version: 41
emulator: VERBOSE: AdbInterface.cpp:253: Path:/opt/software/sdks/android/sdk/platform-tools/adb protocol version: 41
emulator: WARNING: Your AVD has been configured with an in-guest renderer, but the system image does not support guest rendering.Falling back to 'swiftshader_indirect' mode.
emulator: GPU emulation enabled using 'swiftshader_indirect' mode
emulator: Initializing hardware OpenGLES emulation support
emulator: Found 3 DNS servers: ............................
Content of hardware configuration file:
  hw.cpu.arch = x86_64
  hw.cpu.ncore = 2
  hw.ramSize = 1536
  hw.screen = multi-touch
  hw.mainKeys = false
  hw.trackBall = false
  hw.keyboard = false
  hw.keyboard.lid = false
  hw.keyboard.charmap = qwerty2
  hw.dPad = false
  hw.rotaryInput = false
  hw.gsmModem = true
  hw.gps = true
  hw.battery = true
  hw.accelerometer = true
  hw.gyroscope = true
  hw.audioInput = true
  hw.audioOutput = true
  hw.sdCard = true
  disk.cachePartition = true
  disk.cachePartition.path = /root/.android/avd/pixel_xl.avd/cache.img
  disk.cachePartition.size = 66m
  test.quitAfterBootTimeOut = -1
  test.delayAdbTillBootComplete = 0
  test.monitorAdb = 0
  hw.lcd.width = 1440
  hw.lcd.height = 2560
  hw.lcd.depth = 16
  hw.lcd.density = 560
  hw.lcd.backlight = true
  hw.displayRegion.0.1.xOffset = -1
  hw.displayRegion.0.1.yOffset = -1
  hw.displayRegion.0.1.width = 0
  hw.displayRegion.0.1.height = 0
  hw.fold.adjust = false
  hw.gpu.enabled = true
  hw.gpu.mode = swiftshader_indirect
  hw.initialOrientation = portrait
  hw.camera.back = emulated
  hw.camera.front = none
  vm.heapSize = 384
  hw.sensors.light = true
  hw.sensors.pressure = true
  hw.sensors.humidity = true
  hw.sensors.proximity = true
  hw.sensors.magnetic_field = true
  hw.sensors.magnetic_field_uncalibrated = true
  hw.sensors.gyroscope_uncalibrated = true
  hw.sensors.orientation = true
  hw.sensors.temperature = true
  hw.useext4 = true
  hw.arc = false
  hw.arc.autologin = false
  kernel.path = /opt/software/sdks/android/sdk/system-images/android-28/google_apis/x86_64//kernel-ranchu
  kernel.newDeviceNaming = yes
  kernel.supportsYaffs2 = no
  disk.ramdisk.path = /opt/software/sdks/android/sdk/system-images/android-28/google_apis/x86_64//ramdisk.img
  disk.systemPartition.initPath = /opt/software/sdks/android/sdk/system-images/android-28/google_apis/x86_64//system.img
  disk.systemPartition.size = 2562m
  disk.vendorPartition.initPath = /opt/software/sdks/android/sdk/system-images/android-28/google_apis/x86_64//vendor.img
  disk.vendorPartition.size = 800m
  disk.dataPartition.path = /root/.android/avd/pixel_xl.avd/userdata-qemu.img
  disk.dataPartition.initPath = /opt/software/sdks/android/sdk/system-images/android-28/google_apis/x86_64//userdata.img
  disk.dataPartition.size = 800m
  disk.encryptionKeyPartition.path = /root/.android/avd/pixel_xl.avd/encryptionkey.img
  PlayStore.enabled = false
  avd.name = pixel_xl
  fastboot.forceColdBoot = false
.
QEMU options list:
emulator: argv[00] = "/opt/software/sdks/android/sdk/emulator/qemu/linux-x86_64/qemu-system-x86_64-headless"
emulator: argv[01] = "-dns-server"
emulator: argv[02] = "………………………………………"
emulator: argv[03] = "-serial"
emulator: argv[04] = "null"
emulator: argv[05] = "-device"
emulator: argv[06] = "goldfish_pstore,addr=0xff018000,size=0x10000,file=/root/.android/avd/pixel_xl.avd/data/misc/pstore/pstore.bin"
emulator: argv[07] = "-cpu"
emulator: argv[08] = "android64"
emulator: argv[09] = "-enable-kvm"
emulator: argv[10] = "-smp"
emulator: argv[11] = "cores=2"
emulator: argv[12] = "-m"
emulator: argv[13] = "1536"
emulator: argv[14] = "-lcd-density"
emulator: argv[15] = "560"
emulator: argv[16] = "-object"
emulator: argv[17] = "iothread,id=disk-iothread"
emulator: argv[18] = "-nodefaults"
emulator: argv[19] = "-kernel"
emulator: argv[20] = "/opt/software/sdks/android/sdk/system-images/android-28/google_apis/x86_64//kernel-ranchu"
emulator: argv[21] = "-initrd"
emulator: argv[22] = "/opt/software/sdks/android/sdk/system-images/android-28/google_apis/x86_64//ramdisk.img"
emulator: argv[23] = "-drive"
emulator: argv[24] = "if=none,index=0,id=system,file=/opt/software/sdks/android/sdk/system-images/android-28/google_apis/x86_64//system.img,read-only"
emulator: argv[25] = "-device"
emulator: argv[26] = "virtio-blk-pci,drive=system,iothread=disk-iothread,modern-pio-notify"
emulator: argv[27] = "-drive"
emulator: argv[28] = "if=none,index=1,id=cache,file=/root/.android/avd/pixel_xl.avd/cache.img.qcow2,overlap-check=none,cache=unsafe,l2-cache-size=1048576"
emulator: argv[29] = "-device"
emulator: argv[30] = "virtio-blk-pci,drive=cache,iothread=disk-iothread,modern-pio-notify"
emulator: argv[31] = "-drive"
emulator: argv[32] = "if=none,index=2,id=userdata,file=/root/.android/avd/pixel_xl.avd/userdata-qemu.img.qcow2,overlap-check=none,cache=unsafe,l2-cache-size=1048576"
emulator: argv[33] = "-device"
emulator: argv[34] = "virtio-blk-pci,drive=userdata,iothread=disk-iothread,modern-pio-notify"
emulator: argv[35] = "-drive"
emulator: argv[36] = "if=none,index=3,id=encrypt,file=/root/.android/avd/pixel_xl.avd/encryptionkey.img.qcow2,overlap-check=none,cache=unsafe,l2-cache-size=1048576"
emulator: argv[37] = "-device"
emulator: argv[38] = "virtio-blk-pci,drive=encrypt,iothread=disk-iothread,modern-pio-notify"
emulator: argv[39] = "-drive"
emulator: argv[40] = "if=none,index=4,id=vendor,file=/opt/software/sdks/android/sdk/system-images/android-28/google_apis/x86_64//vendor.img,read-only"
emulator: argv[41] = "-device"
emulator: argv[42] = "virtio-blk-pci,drive=vendor,iothread=disk-iothread,modern-pio-notify"
emulator: argv[43] = "-netdev"
emulator: argv[44] = "user,id=mynet"
emulator: argv[45] = "-device"
emulator: argv[46] = "virtio-net-pci,netdev=mynet"
emulator: argv[47] = "-device"
emulator: argv[48] = "virtio-rng-pci"
emulator: argv[49] = "-show-cursor"
emulator: argv[50] = "-L"
emulator: argv[51] = "/opt/software/sdks/android/sdk/emulator/lib/pc-bios"
emulator: argv[52] = "-soundhw"
emulator: argv[53] = "hda"
emulator: argv[54] = "-vga"
emulator: argv[55] = "none"
emulator: argv[56] = "-append"
emulator: argv[57] = "qemu=1 no_timer_check androidboot.hardware=ranchu androidboot.serialno=EMULATOR29X0X11X0 clocksource=pit no-kvmclock android.qemud=1 console=0 android.checkjni=1 qemu.gles=1 qemu.settings.system.screen_off_timeout=2147483647 qemu.encrypt=1 qemu.opengles.version=131072 cma=314M@0-4G ndns=3 qemu.wifi=1 mac80211_hwsim.channels=2 androidboot.android_dt_dir=/sys/bus/platform/devices/ANDR0001:00/properties/android/ skip_initramfs rootwait ro init=/init loop.max_part=7 dm="1 vroot none ro 1,0 5159992 verity 1 PARTUUID=CDC502B1-71E4-4C31-AEC3-87250E21C0B8 PARTUUID=CDC502B1-71E4-4C31-AEC3-87250E21C0B8 4096 4096 644999 644999 sha1 4b9c37238cf8661b9099c4022d58a1aab10bec62 3f0e9a0fcc7cd635abd56d704b028ca2078049c6 1 ignore_zero_blocks" androidboot.veritymode=enforcing androidboot.verifiedbootstate=orange root=/dev/dm-0 ramoops.mem_address=0xff018000 ramoops.mem_size=0x10000 memmap=0x10000$0xff018000 qemu.dalvik.vm.heapsize=384m"
emulator: argv[58] = "-android-hw"
emulator: argv[59] = "/root/.android/avd/pixel_xl.avd/hardware-qemu.ini"
Concatenated QEMU options:
 /opt/software/sdks/android/sdk/emulator/qemu/linux-x86_64/qemu-system-x86_64-headless -dns-server ……………… -serial null -device goldfish_pstore,addr=0xff018000,size=0x10000,file=/root/.android/avd/pixel_xl.avd/data/misc/pstore/pstore.bin -cpu android64 -enable-kvm -smp cores=2 -m 1536 -lcd-density 560 -object iothread,id=disk-iothread -nodefaults -kernel /opt/software/sdks/android/sdk/system-images/android-28/google_apis/x86_64//kernel-ranchu -initrd /opt/software/sdks/android/sdk/system-images/android-28/google_apis/x86_64//ramdisk.img -drive if=none,index=0,id=system,file=/opt/software/sdks/android/sdk/system-images/android-28/google_apis/x86_64//system.img,read-only -device virtio-blk-pci,drive=system,iothread=disk-iothread,modern-pio-notify -drive if=none,index=1,id=cache,file=/root/.android/avd/pixel_xl.avd/cache.img.qcow2,overlap-check=none,cache=unsafe,l2-cache-size=1048576 -device virtio-blk-pci,drive=cache,iothread=disk-iothread,modern-pio-notify -drive if=none,index=2,id=userdata,file=/root/.android/avd/pixel_xl.avd/userdata-qemu.img.qcow2,overlap-check=none,cache=unsafe,l2-cache-size=1048576 -device virtio-blk-pci,drive=userdata,iothread=disk-iothread,modern-pio-notify -drive if=none,index=3,id=encrypt,file=/root/.android/avd/pixel_xl.avd/encryptionkey.img.qcow2,overlap-check=none,cache=unsafe,l2-cache-size=1048576 -device virtio-blk-pci,drive=encrypt,iothread=disk-iothread,modern-pio-notify -drive if=none,index=4,id=vendor,file=/opt/software/sdks/android/sdk/system-images/android-28/google_apis/x86_64//vendor.img,read-only -device virtio-blk-pci,drive=vendor,iothread=disk-iothread,modern-pio-notify -netdev user,id=mynet -device virtio-net-pci,netdev=mynet -device virtio-rng-pci -show-cursor -L /opt/software/sdks/android/sdk/emulator/lib/pc-bios -soundhw hda -vga none -append 'qemu=1 no_timer_check androidboot.hardware=ranchu androidboot.serialno=EMULATOR29X0X11X0 clocksource=pit no-kvmclock android.qemud=1 console=0 android.checkjni=1 qemu.gles=1 qemu.settings.system.screen_off_timeout=2147483647 qemu.encrypt=1 qemu.opengles.version=131072 cma=314M@0-4G ndns=3 qemu.wifi=1 mac80211_hwsim.channels=2 androidboot.android_dt_dir=/sys/bus/platform/devices/ANDR0001:00/properties/android/ skip_initramfs rootwait ro init=/init loop.max_part=7 dm="1 vroot none ro 1,0 5159992 verity 1 PARTUUID=CDC502B1-71E4-4C31-AEC3-87250E21C0B8 PARTUUID=CDC502B1-71E4-4C31-AEC3-87250E21C0B8 4096 4096 644999 644999 sha1 4b9c37238cf8661b9099c4022d58a1aab10bec62 3f0e9a0fcc7cd635abd56d704b028ca2078049c6 1 ignore_zero_blocks" androidboot.veritymode=enforcing androidboot.verifiedbootstate=orange root=/dev/dm-0 ramoops.mem_address=0xff018000 ramoops.mem_size=0x10000 memmap=0x10000$0xff018000 qemu.dalvik.vm.heapsize=384m' -android-hw /root/.android/avd/pixel_xl.avd/hardware-qemu.ini
emulator: Android qemu version 29.0.11.0 (build_id 5598178) (CL:N/A)

emulator: Starting QEMU main loop
emulator: Adding boot property: 'ro.opengles.version' = '131072'
emulator: Adding boot property: 'qemu.sf.fake_camera' = 'back'
emulator: Adding boot property: 'dalvik.vm.heapsize' = '384m'
emulator: Adding boot property: 'qemu.hw.mainkeys' = '0'
emulator: Adding boot property: 'qemu.sf.lcd_density' = '560'
emulator: goldfish_events.have-dpad: false
emulator: goldfish_events.have-trackball: false
emulator: goldfish_events.have-camera: true
emulator: goldfish_events.have-keyboard: false
emulator: goldfish_events.have-lidswitch: false
emulator: goldfish_events.have-tabletmode: false
emulator: goldfish_events.have-touch: false
emulator: goldfish_events.have-multitouch: true
emulator: control console listening on port 5554, ADB on port 5555
pulseaudio: Failed to initialize PA contextaudio: Could not init `pa' audio driver
setting up http proxy: proxy=104.129.198.34 port=9400
emulator: Adding boot property: 'qemu.timezone' = 'Etc/UCT'
emulator: android_hw_fingerprint_init: fingerprint qemud listen service initialized

emulator: emulator_window_fb_rotate

emulator: No acpi ini file provided, using defaul`enter code here`t

emulator: No acpi ini file provided, using default

emulator: onGuestSendCommand: [0x94d1e00] Adb connected, start proxing data
Segmentation fault
android android-emulator android-virtual-device android-sdk-tools
2个回答
0
投票

尝试禁用selinux。

打开文件

/etc/selinux/config
并设置
SELINUX=disabled

重新启动后,确保命令

sestatus
返回

SELinux 状态:已禁用


0
投票

在我的 Arch Linux 系统(我已经安装了

gperftools
)上对我有帮助的是将 libtcmalloc_minimal.so.4 文件复制到 SDK 目录:

cp /usr/lib/libtcmalloc_minimal.so.4 emulator/lib64/libtcmalloc_minimal.so.4
© www.soinside.com 2019 - 2024. All rights reserved.