解决方法
emulator -verbose -show-kernel -shell
VERBOSE: AdbHostServer.cpp:49: Send [000chost:version] to adb daemon.
VERBOSE: AdbHostServer.cpp:69: ReadResponse: [OKAY]
VERBOSE: AdbHostServer.cpp:69: ReadResponse: [0004]
VERBOSE: AdbHostServer.cpp:69: ReadResponse: [0029]
VERBOSE: AdbHostServer.cpp:115: Server version: 41
VERBOSE: AdbHostServer.cpp:49: Send [000chost:version] to adb daemon.
VERBOSE: AdbHostServer.cpp:69: ReadResponse: [OKAY]
VERBOSE: AdbHostServer.cpp:69: ReadResponse: [0004]
VERBOSE: AdbHostServer.cpp:69: ReadResponse: [0029]
VERBOSE: AdbHostServer.cpp:115: Server version: 41
能看到一直在重复和adb daemon通信
此时adb device查看设备,可以看到
emulator-5554 offline
代表5555端口被占用,模拟器无法开机
解决思路是
lsof -i:5555
找出所有占用5555端口的进程,直接杀掉 kill -9 pid
重新
source build/envsetup.sh
lunch
emulator -verbose -show-kernel -shell
等待模拟器开机即可
我看了一下命令行没有报错,一直在往adb daemon发命令,但是adb连接不上
这是adb devices的输出
adb server version (41) doesn't match this client (39); killing...
ADB server didn't ACK
Full server startup log: /tmp/adb.1000.log
Server had pid: 12950
--- adb starting (pid 12950) ---
adb I 08-20 06:50:09 12950 12950 main.cpp:57] Android Debug Bridge version 1.0.39
adb I 08-20 06:50:09 12950 12950 main.cpp:57] Version 1:8.1.0+r23-5~18.04
adb I 08-20 06:50:09 12950 12950 main.cpp:57] Installed as /usr/lib/android-sdk/platform-tools/adb
adb I 08-20 06:50:09 12950 12950 main.cpp:57]
adb I 08-20 06:50:09 12950 12950 adb_auth_host.cpp:416] adb_auth_init...
adb I 08-20 06:50:09 12950 12950 adb_auth_host.cpp:174] read_key_file '/home/aosp/.android/adbkey'...
adb I 08-20 06:50:09 12950 12950 adb_auth_host.cpp:391] adb_auth_inotify_init...
adb server killed by remote request
* failed to start daemon
error: cannot connect to daemon
下面是emulator的输出
emulator: Android emulator version 29.0.1.0 (build_id 5441143) (CL:N/A)
emulator: Found ANDROID_PRODUCT_OUT: /home/aosp/android10.0/out/target/product/flame
emulator: Found build target architecture: arm64
emulator: argv[0]: 'emulator'; program directory: '/home/aosp/android10.0/prebuilts/android-emulator/linux-x86_64'
emulator: emuDirName: '/home/aosp/android10.0/prebuilts/android-emulator/emulator'
emulator: try dir /home/aosp/android10.0/prebuilts/android-emulator/linux-x86_64
emulator: Trying emulator path '/home/aosp/android10.0/prebuilts/android-emulator/linux-x86_64/qemu/linux-x86_64/qemu-system-aarch64'
emulator: Found target-specific 64-bit emulator binary: /home/aosp/android10.0/prebuilts/android-emulator/linux-x86_64/qemu/linux-x86_64/qemu-system-aarch64
emulator: Adding library search path: '/home/aosp/android10.0/prebuilts/android-emulator/linux-x86_64/lib64'
emulator: Adding library search path: '/home/aosp/android10.0/prebuilts/android-emulator/linux-x86_64/lib64/gles_swiftshader'
emulator: Adding library search path: '/home/aosp/android10.0/prebuilts/android-emulator/linux-x86_64/lib64/gles_angle'
emulator: Adding library search path: '/home/aosp/android10.0/prebuilts/android-emulator/linux-x86_64/lib64/gles_angle9'
emulator: Adding library search path: '/home/aosp/android10.0/prebuilts/android-emulator/linux-x86_64/lib64/gles_angle11'
emulator: Adding library search path: '/home/aosp/android10.0/prebuilts/android-emulator/linux-x86_64/lib64/libstdc++'
emulator: Adding library search path for Qt: '/home/aosp/android10.0/prebuilts/android-emulator/linux-x86_64/lib64/qt/lib'
emulator: Setting Qt plugin search path: QT_QPA_PLATFORM_PLUGIN_PATH=/home/aosp/android10.0/prebuilts/android-emulator/linux-x86_64/lib64/qt/plugins
emulator: Setting Qt to use software OpenGL: QT_OPENGL=software
emulator: Overriding pre-existing bad Qt high dpi settings...
emulator: Running :/home/aosp/android10.0/prebuilts/android-emulator/linux-x86_64/qemu/linux-x86_64/qemu-system-aarch64
emulator: qemu backend: argv[00] = "/home/aosp/android10.0/prebuilts/android-emulator/linux-x86_64/qemu/linux-x86_64/qemu-system-aarch64"
emulator: qemu backend: argv[01] = "-verbose"
emulator: qemu backend: argv[02] = "-show-kernel"
emulator: qemu backend: argv[03] = "-shell"
emulator: Concatenated backend parameters:
/home/aosp/android10.0/prebuilts/android-emulator/linux-x86_64/qemu/linux-x86_64/qemu-system-aarch64 -verbose -show-kernel -shell
emulator: WARNING: Couldn't find crash service executable /home/aosp/android10.0/prebuilts/android-emulator/linux-x86_64/emulator64-crash-service
emulator: found Android build root: /home/aosp/android10.0
emulator: found Android build out: /home/aosp/android10.0/out/target/product/flame
emulator: Read property file at /home/aosp/android10.0/out/target/product/flame/system/build.prop
emulator: Cannot find boot properties file: /home/aosp/android10.0/out/target/product/flame/boot.prop
emulator: Found target API sdkVersion: 29
emulator: Invalid int property: 'ro.build.version.incremental:eng.aosp.20230820.041229'
emulator: virtual device has no config file - no problem
emulator: using core hw config path: /home/aosp/android10.0/out/target/product/flame/hardware-qemu.ini
emulator: using snapshot lock path: /home/aosp/android10.0/out/target/product/flame/snapshot.lock
emulator: using multi-instance lock path: /home/aosp/android10.0/out/target/product/flame/multiinstance.lock
emulator: found skin-specific hardware.ini: /home/aosp/android10.0/development/tools/emulator/skins//HVGA/hardware.ini
emulator: autoconfig: -skin HVGA
emulator: autoconfig: -skindir /home/aosp/android10.0/development/tools/emulator/skins/
emulator: found skin-specific hardware.ini: /home/aosp/android10.0/development/tools/emulator/skins//HVGA/hardware.ini
emulator: autoconfig: -kernel /home/aosp/android10.0/prebuilts/qemu-kernel/arm64/ranchu/kernel-qemu
emulator: Target arch = 'arm64'
emulator: Auto-detect: Kernel image requires new device naming scheme.
emulator: Auto-detect: Kernel does not support YAFFS2 partitions.
emulator: autoconfig: -ramdisk /home/aosp/android10.0/out/target/product/flame/ramdisk.img
emulator: autoconfig: -sysdir /home/aosp/android10.0/out/target/product/flame
emulator: Using initial system image: /home/aosp/android10.0/out/target/product/flame/system.img
emulator: Using initial vendor image: /home/aosp/android10.0/out/target/product/flame/vendor.img
emulator: autoconfig: -data /home/aosp/android10.0/out/target/product/flame/userdata-qemu.img
emulator: autoconfig: -initdata /home/aosp/android10.0/out/target/product/flame/userdata.img
emulator: autoconfig: -cache /home/aosp/android10.0/out/target/product/flame/cache.img
emulator: Increasing RAM size to 2048MB
emulator: VM heap size 48MB is below hardware specified minimum of 192MB,setting it to that value
emulator: System image is read only
emulator: Found 1 DNS servers: 127.0.0.53
emulator: trying to load skin file '/home/aosp/android10.0/development/tools/emulator/skins//HVGA/layout'
emulator: WARNING: encryption is off
VERBOSE: AdbInterface.cpp:202: no root specified:
VERBOSE: AdbInterface.cpp:202: no root specified:
VERBOSE: AdbInterface.cpp:232: Found: 1 adb executables
VERBOSE: AdbInterface.cpp:234: Adb: /home/aosp/android10.0/out/soong/host/linux-x86/bin/adb
VERBOSE: AdbInterface.cpp:253: Path:/home/aosp/android10.0/out/soong/host/linux-x86/bin/adb protocol version: 41
VERBOSE: AdbHostServer.cpp:49: Send [000chost:version] to adb daemon.
VERBOSE: AdbHostServer.cpp:69: ReadResponse: [OKAY]
VERBOSE: AdbHostServer.cpp:69: ReadResponse: [0004]
VERBOSE: AdbHostServer.cpp:69: ReadResponse: [0029]
VERBOSE: AdbHostServer.cpp:115: Server version: 41
VERBOSE: AdbHostServer.cpp:49: Send [000chost:version] to adb daemon.
VERBOSE: AdbHostServer.cpp:69: ReadResponse: [OKAY]
VERBOSE: AdbHostServer.cpp:69: ReadResponse: [0004]
VERBOSE: AdbHostServer.cpp:69: ReadResponse: [0029]
VERBOSE: AdbHostServer.cpp:115: Server version: 41
emulator: GPU emulation enabled using 'host' mode
emulator: Initializing hardware OpenGLES emulation support
VERBOSE: load_config.cpp:242: Verified boot params were not found.
emulator: Found 1 DNS servers: 127.0.0.53
Content of hardware configuration file:
hw.cpu.arch = arm64
hw.cpu.ncore = 2
hw.ramSize = 2048
hw.screen = multi-touch
hw.mainKeys = true
hw.trackBall = true
hw.keyboard = false
hw.keyboard.lid = false
hw.keyboard.charmap = qwerty2
hw.dPad = true
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 = /home/aosp/android10.0/out/target/product/flame/cache.img
disk.cachePartition.size = 66m
test.quitAfterBootTimeOut = -1
hw.lcd.width = 320
hw.lcd.height = 480
hw.lcd.depth = 16
hw.lcd.density = 160
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 = host
hw.initialOrientation = portrait
hw.camera.back = emulated
hw.camera.front = none
vm.heapSize = 192
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 = /home/aosp/android10.0/prebuilts/qemu-kernel/arm64/ranchu/kernel-qemu
kernel.newDeviceNaming = yes
kernel.supportsYaffs2 = no
disk.ramdisk.path = /home/aosp/android10.0/out/target/product/flame/ramdisk.img
disk.systemPartition.initPath = /home/aosp/android10.0/out/target/product/flame/system.img
disk.systemPartition.size = 800m
disk.vendorPartition.initPath = /home/aosp/android10.0/out/target/product/flame/vendor.img
disk.vendorPartition.size = 800m
disk.dataPartition.path = /home/aosp/android10.0/out/target/product/flame/userdata-qemu.img
disk.dataPartition.size = 800m
PlayStore.enabled = false
avd.name = <build>
fastboot.forceColdBoot = false
.
QEMU options list:
emulator: argv[00] = "/home/aosp/android10.0/prebuilts/android-emulator/linux-x86_64/qemu/linux-x86_64/qemu-system-aarch64"
emulator: argv[01] = "-dns-server"
emulator: argv[02] = "127.0.0.53"
emulator: argv[03] = "-serial"
emulator: argv[04] = "stdio"
emulator: argv[05] = "-device"
emulator: argv[06] = "goldfish_pstore,addr=0xff018000,size=0x10000,file=/home/aosp/android10.0/out/target/product/flame/build.avd/data/misc/pstore/pstore.bin"
emulator: argv[07] = "-cpu"
emulator: argv[08] = "cortex-a57"
emulator: argv[09] = "-machine"
emulator: argv[10] = "type=ranchu"
emulator: argv[11] = "-m"
emulator: argv[12] = "2048"
emulator: argv[13] = "-lcd-density"
emulator: argv[14] = "160"
emulator: argv[15] = "-nodefaults"
emulator: argv[16] = "-kernel"
emulator: argv[17] = "/home/aosp/android10.0/prebuilts/qemu-kernel/arm64/ranchu/kernel-qemu"
emulator: argv[18] = "-initrd"
emulator: argv[19] = "/home/aosp/android10.0/out/target/product/flame/ramdisk.img"
emulator: argv[20] = "-drive"
emulator: argv[21] = "index=0,id=vendor,file=/home/aosp/android10.0/out/target/product/flame/vendor.img,read-only"
emulator: argv[22] = "-device"
emulator: argv[23] = "virtio-blk-device,drive=vendor"
emulator: argv[24] = "-drive"
emulator: argv[25] = "index=1,id=userdata,file=/home/aosp/android10.0/out/target/product/flame/userdata-qemu.img.qcow2,overlap-check=none,cache=unsafe,l2-cache-size=1048576"
emulator: argv[26] = "-device"
emulator: argv[27] = "virtio-blk-device,drive=userdata"
emulator: argv[28] = "-drive"
emulator: argv[29] = "index=2,id=cache,file=/home/aosp/android10.0/out/target/product/flame/cache.img.qcow2,overlap-check=none,cache=unsafe,l2-cache-size=1048576"
emulator: argv[30] = "-device"
emulator: argv[31] = "virtio-blk-device,drive=cache"
emulator: argv[32] = "-drive"
emulator: argv[33] = "index=3,id=system,file=/home/aosp/android10.0/out/target/product/flame/system.img,read-only"
emulator: argv[34] = "-device"
emulator: argv[35] = "virtio-blk-device,drive=system"
emulator: argv[36] = "-netdev"
emulator: argv[37] = "user,id=mynet"
emulator: argv[38] = "-device"
emulator: argv[39] = "virtio-net-device,netdev=mynet"
emulator: argv[40] = "-device"
emulator: argv[41] = "virtio-rng-device"
emulator: argv[42] = "-show-cursor"
emulator: argv[43] = "-L"
emulator: argv[44] = "/home/aosp/android10.0/prebuilts/android-emulator/linux-x86_64/lib/pc-bios"
emulator: argv[45] = "-append"
emulator: argv[46] = "qemu=1 no_timer_check androidboot.hardware=ranchu androidboot.serialno=EMULATOR29X0X1X0 console=ttyAMA0,38400 keep_bootcon earlyprintk=ttyAMA0 androidboot.console=ttyAMA0 android.qemud=1 android.checkjni=1 qemu.gles=1 qemu.settings.system.screen_off_timeout=2147483647 qemu.opengles.version=131072 cma=4M@0-4G loop.max_part=7 ramoops.mem_address=0xff018000 ramoops.mem_size=0x10000 memmap=0x10000$0xff018000 qemu.dalvik.vm.heapsize=192m"
emulator: argv[47] = "-android-hw"
emulator: argv[48] = "/home/aosp/android10.0/out/target/product/flame/hardware-qemu.ini"
Concatenated QEMU options:
/home/aosp/android10.0/prebuilts/android-emulator/linux-x86_64/qemu/linux-x86_64/qemu-system-aarch64 -dns-server 127.0.0.53 -serial stdio -device goldfish_pstore,addr=0xff018000,size=0x10000,file=/home/aosp/android10.0/out/target/product/flame/build.avd/data/misc/pstore/pstore.bin -cpu cortex-a57 -machine type=ranchu -m 2048 -lcd-density 160 -nodefaults -kernel /home/aosp/android10.0/prebuilts/qemu-kernel/arm64/ranchu/kernel-qemu -initrd /home/aosp/android10.0/out/target/product/flame/ramdisk.img -drive index=0,id=vendor,file=/home/aosp/android10.0/out/target/product/flame/vendor.img,read-only -device virtio-blk-device,drive=vendor -drive index=1,id=userdata,file=/home/aosp/android10.0/out/target/product/flame/userdata-qemu.img.qcow2,overlap-check=none,cache=unsafe,l2-cache-size=1048576 -device virtio-blk-device,drive=userdata -drive index=2,id=cache,file=/home/aosp/android10.0/out/target/product/flame/cache.img.qcow2,overlap-check=none,cache=unsafe,l2-cache-size=1048576 -device virtio-blk-device,drive=cache -drive index=3,id=system,file=/home/aosp/android10.0/out/target/product/flame/system.img,read-only -device virtio-blk-device,drive=system -netdev user,id=mynet -device virtio-net-device,netdev=mynet -device virtio-rng-device -show-cursor -L /home/aosp/android10.0/prebuilts/android-emulator/linux-x86_64/lib/pc-bios -append 'qemu=1 no_timer_check androidboot.hardware=ranchu androidboot.serialno=EMULATOR29X0X1X0 console=ttyAMA0,38400 keep_bootcon earlyprintk=ttyAMA0 androidboot.console=ttyAMA0 android.qemud=1 android.checkjni=1 qemu.gles=1 qemu.settings.system.screen_off_timeout=2147483647 qemu.opengles.version=131072 cma=4M@0-4G loop.max_part=7 ramoops.mem_address=0xff018000 ramoops.mem_size=0x10000 memmap=0x10000$0xff018000 qemu.dalvik.vm.heapsize=192m' -android-hw /home/aosp/android10.0/out/target/product/flame/hardware-qemu.ini
emulator: Android qemu version 29.0.1.0 (build_id 5441143) (CL:N/A)
emulator: Starting QEMU main loop
VERBOSE: AdbHostServer.cpp:49: Send [000chost:version] to adb daemon.
VERBOSE: AdbHostServer.cpp:69: ReadResponse: [OKAY]
VERBOSE: AdbHostServer.cpp:69: ReadResponse: [0004]
VERBOSE: AdbHostServer.cpp:69: ReadResponse: [0029]
VERBOSE: AdbHostServer.cpp:115: Server version: 41
emulator: registered 'boot-properties' qemud service
emulator: Adding boot property: 'ro.opengles.version' = '131072'
emulator: Adding boot property: 'qemu.sf.fake_camera' = 'back'
emulator: Adding boot property: 'dalvik.vm.heapsize' = '192m'
emulator: Adding boot property: 'qemu.hw.mainkeys' = '1'
emulator: Adding boot property: 'qemu.sf.lcd_density' = '160'
emulator: goldfish_events.have-dpad: true
emulator: goldfish_events.have-trackball: true
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
VERBOSE: AdbHostServer.cpp:49: Send [0012host:emulator:5555] to adb daemon.
Not using any http proxy
emulator: Adding boot property: 'qemu.timezone' = 'America/Los_Angeles'
emulator: android_hw_fingerprint_init: fingerprint qemud listen service initialized
emulator: emulator_window_fb_rotate
VERBOSE: AdbHostServer.cpp:49: Send [000chost:version] to adb daemon.
VERBOSE: AdbHostServer.cpp:69: ReadResponse: [OKAY]
VERBOSE: AdbHostServer.cpp:69: ReadResponse: [0004]
VERBOSE: AdbHostServer.cpp:69: ReadResponse: [0029]
VERBOSE: AdbHostServer.cpp:115: Server version: 41
emulator: Adding boot property: 'ro.opengles.version' = '131072'
emulator: Adding boot property: 'qemu.sf.fake_camera' = 'back'
emulator: Adding boot property: 'dalvik.vm.heapsize' = '192m'
emulator: Adding boot property: 'qemu.hw.mainkeys' = '1'
emulator: Adding boot property: 'qemu.sf.lcd_density' = '160'
emulator: Adding boot property: 'qemu.timezone' = 'America/Los_Angeles'
VERBOSE: AdbHostServer.cpp:49: Send [000chost:version] to adb daemon.
VERBOSE: AdbHostServer.cpp:69: ReadResponse: [OKAY]
VERBOSE: AdbHostServer.cpp:69: ReadResponse: [0004]
VERBOSE: AdbHostServer.cpp:69: ReadResponse: [0029]
VERBOSE: AdbHostServer.cpp:115: Server version: 41
VERBOSE: AdbHostServer.cpp:49: Send [000chost:version] to adb daemon.
VERBOSE: AdbHostServer.cpp:69: ReadResponse: [OKAY]
VERBOSE: AdbHostServer.cpp:69: ReadResponse: [0004]
VERBOSE: AdbHostServer.cpp:69: ReadResponse: [0029]
VERBOSE: AdbHostServer.cpp:115: Server version: 41
VERBOSE: AdbHostServer.cpp:49: Send [000chost:version] to adb daemon.
VERBOSE: AdbHostServer.cpp:69: ReadResponse: [OKAY]
VERBOSE: AdbHostServer.cpp:69: ReadResponse: [0004]
VERBOSE: AdbHostServer.cpp:69: ReadResponse: [0029]
VERBOSE: AdbHostServer.cpp:115: Server version: 41
VERBOSE: AdbHostServer.cpp:49: Send [000chost:version] to adb daemon.