uber / nanoscope

An extremely accurate Android method tracing tool.
Apache License 2.0
1.25k stars 68 forks source link

Android on emulator loads infinitely #58

Closed MichaelRocks closed 5 years ago

MichaelRocks commented 6 years ago

I wanted to try nanoscope on emulator, installed it from Homebrew, launched the emulator with nanoscope emulator but the emulator never finished launching. Unfortunately, I don't know what information I need to provide so you can reproduce this issue. But I'm ready to try it again and send you some logs.

Leland-Takamine commented 6 years ago

I've had one other report of this internally. Can you paste both the output of the terminal command and the logcat output (if any)?

MichaelRocks commented 6 years ago

Seems Android compiles some classes but does it very slowly. I'll try to wait for 12 hours or so. Maybe it'll finish. logcat.log output.log

Leland-Takamine commented 6 years ago

Looks like it's due to HAXM not loading:

HAXM is not working and emulator runs in emulation mode

This will cause the emulator to run much slower. Do you have HAXM installed?

MichaelRocks commented 6 years ago

Yes, I have it installed and emulators from Android SDK work just fine. I waited for a little longer and it seems Android entered some kind of a boot-loop. logcat.log

Leland-Takamine commented 6 years ago

Ok, I'll try to take a look at this more but it may not be for a couple weeks since I'm on vacation. My guess is that this is due to HAXM not loading, so if you can solve that then it may fix the issue. Found this after a brief search - hopefully helpful.

MichaelRocks commented 6 years ago

Seems I managed to load the emulator with HAXM support by manually loading HAXM kext with sudo kextload -b com.intel.kext.intelhaxm. I ran this command, then allowed loading the extension in System Preferences -> Security & Privacy, and then ran the same command again. Now nanoscope emulator prints the following lines:

emulator: CPU Acceleration: working
emulator: CPU Acceleration status: HAXM version 7.1.0 (4) is installed and usable.

Add the emulator even managed to load Android but it took quite a long time comparing to default emulators from Android SDK.

CheerS17 commented 6 years ago

I encounter the same problem, also installed HAXM from Android Studio and manually, but neither work.

CheerS17 commented 6 years ago

Finally solve this problem, I tried those steps one by one, but I don't know which one really works.

  1. kill all adb service, then restart, try again.
  2. Restart Mac, try again.
  3. Uninstall HAXM, then re-install, set the RAM to recommended size(2GB for me), restart Mac, try again.

The booting of emulator takes several minutes (5-10 mins for me).

Leland-Takamine commented 6 years ago

The booting of emulator takes several minutes (5-10 mins for me).

@CheerS17 That seems like a long time for a HAXM emulator. Are you sure HAXM successfully loads? Mind pasting the logs from the nanoscope emulator command here?

CheerS17 commented 6 years ago

I think so, I can see this log: emulator:

Adding boot property: 'ro.opengles.version' = '131072' HAXM is working and emulator runs in fast virt mode.

here are all outputs after typing nanoscope emulator.

Launching emulator... emulator: autoconfig: -vendor ./vendor.img emulator: autoconfig: -datadir . emulator: Read property file at ./system/build.prop emulator: Cannot find boot properties file: ./boot.prop

emulator: Found target API sdkVersion: 25

emulator: Invalid int property: 'ro.build.version.incremental:eng.leland.20180507.124526' emulator: virtual device config file: ./config.ini emulator: using core hw config path: ./hardware-qemu.ini emulator: Warning: config.ini contains invalid skin.path entry: (null) emulator: Target arch = 'x86' emulator: Auto-config: -qemu -cpu qemu32 emulator: Auto-detect: Kernel image requires legacy device naming scheme. emulator: Auto-detect: Kernel does not support YAFFS2 partitions. emulator: Using initial system image: ./system.img emulator: Using initial vendor image: ./vendor.img emulator: autoconfig: -initdata ./userdata.img emulator: autoconfig: -cache ./cache.img emulator: autoconfig: -sdcard ./system.img emulator: Physical RAM size: 1024MB

emulator: System image is read only emulator: Found 4 DNS servers: 208.67.222.222 208.67.220.220 114.114.11.114 209.18.47.62 emulator: trying to load skin file '~/Library/Android/sdk/skins/pixel/layout' emulator: GPU emulation enabled using 'host' mode emulator: Initializing hardware OpenGLES emulation support emulator: Found 4 DNS servers: 208.67.222.222 208.67.220.220 114.114.11.114 209.18.47.62 emulator: WARNING: Classic qemu does not support SMP. The hw.cpu.ncore option from your config file is ignored. Content of hardware configuration file: hw.cpu.arch = x86 hw.cpu.model = qemu32 hw.cpu.ncore = 4 hw.ramSize = 1024 hw.screen = multi-touch hw.mainKeys = false hw.trackBall = false hw.keyboard = true 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 hw.sdCard.path = ./system.img disk.cachePartition = true disk.cachePartition.path = ./cache.img disk.cachePartition.size = 66m hw.lcd.width = 1080 hw.lcd.height = 1920 hw.lcd.depth = 16 hw.lcd.density = 480 hw.lcd.backlight = true hw.gpu.enabled = true hw.gpu.mode = host hw.gpu.blacklisted = no hw.initialOrientation = Portrait hw.camera.back = emulated hw.camera.front = emulated vm.heapSize = 256 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 kernel.path = ~/Library/Android/sdk/system-images/android-25/google_apis/x86/kernel-qemu kernel.newDeviceNaming = no kernel.supportsYaffs2 = no disk.ramdisk.path = ./ramdisk.img disk.systemPartition.initPath = ./system.img disk.systemPartition.size = 2056m disk.vendorPartition.initPath = ./vendor.img disk.vendorPartition.size = 2056m disk.dataPartition.path = ././userdata.img disk.dataPartition.size = 2056m PlayStore.enabled = false avd.name = . emulator: CPU Acceleration: working emulator: CPU Acceleration status: HAXM version 7.2.0 (4) is installed and usable. emulator: checking cpu acceleration from main qemu params QEMU options list: emulator: argv[00] = "~/Library/Android/sdk/emulator/emulator64-x86" emulator: argv[01] = "-dns-server" emulator: argv[02] = "208.67.222.222,208.67.220.220,114.114.11.114,209.18.47.62" emulator: argv[03] = "-serial" emulator: argv[04] = "null" emulator: argv[05] = "-serial" emulator: argv[06] = "null" emulator: argv[07] = "-enable-hax" emulator: argv[08] = "-android-hw" emulator: argv[09] = "./hardware-qemu.ini" emulator: argv[10] = "-append" emulator: argv[11] = "qemu=1 androidboot.hardware=goldfish clocksource=pit android.qemud=1 console=0 android.checkjni=1 qemu.gles=1 qemu.opengles.version=131072 ndns=4" Concatenated QEMU options: ~/Library/Android/sdk/emulator/emulator64-x86 -dns-server 208.67.222.222,208.67.220.220,114.114.11.114,209.18.47.62 -serial null -serial null -enable-hax -android-hw ./hardware-qemu.ini -append 'qemu=1 androidboot.hardware=goldfish clocksource=pit android.qemud=1 console=0 android.checkjni=1 qemu.gles=1 qemu.opengles.version=131072 ndns=4' emulator: Warning: config.ini contains invalid skin.path entry: (null) emulator: Starting QEMU main loop emulator: registered 'boot-properties' qemud service emulator: Using kernel serial device prefix: ttyS emulator: AVD Name: emulator: Ramdisk image contains fstab.goldfish file emulator: Found format of system partition: 'ext4' emulator: Could not extract format of vendor partition! emulator: Found format of userdata partition: 'ext4' emulator: Found format of cache partition: 'ext4' emulator: system partition format: ext4 emulator: nand_add_dev: system,size=0x80800000,file=./system.img,pagesize=512,extrasize=0,readonly emulator: userdata partition format: ext4 emulator: nand_add_dev: userdata,size=0x80800000,file=././userdata.img,pagesize=512,extrasize=0 emulator: cache partition format: ext4 emulator: nand_add_dev: cache,size=0x4200000,file=./cache.img,pagesize=512,extrasize=0 emulator: Adding boot property: 'dalvik.vm.heapsize' = '256m' emulator: Adding boot property: 'qemu.sf.lcd_density' = '480' emulator: Adding boot property: 'qemu.hw.mainkeys' = '0' emulator: Adding boot property: 'qemu.sf.fake_camera' = 'both' emulator: Found 4 DNS servers: 208.67.222.222 208.67.220.220 114.114.11.114 209.18.47.62 emulator: Adding boot property: 'ro.opengles.version' = '131072' HAXM is working and emulator runs in fast virt mode emulator: Kernel parameters: qemu=1 androidboot.hardware=goldfish clocksource=pit android.qemud=1 console=0 android.checkjni=1 qemu.gles=1 qemu.opengles.version=131072 ndns=4 emulator: trying to find: ~/Library/Android/sdk/emulator/bios.bin

emulator: trying to find: ~/Library/Android/sdk/emulator/lib/pc-bios/bios.bin

emulator: trying to find: ~/Library/Android/sdk/emulator/vgabios-cirrus.bin

emulator: trying to find: ~/Library/Android/sdk/emulator/lib/pc-bios/vgabios-cirrus.bin

emulator: control console listening on port 5554, ADB on port 5555 Not using any http proxy emulator: android_hw_fingerprint_init: fingerprint qemud listen service initialized

emulator: onGuestSendCommand: [0x7f8394610fa0] Adb connected, start proxing data emulator: ### WARNING: /etc/localtime does not point to /usr/share/zoneinfo/, can't determine zoneinfo timezone name emulator: onGuestClose: [0x7f8394610fa0] Adb closed by guest emulator: onGuestClose: [0x7f839c800dd0] Adb closed by guest emulator: onGuestSendCommand: [0x7f8399df6b10] Adb connected, start proxing data emulator: onGuestRecvData: [0x7f8399df6b10] Adb closed by host emulator: onGuestClose: [0x7f8399df6b10] Adb closed by guest emulator: onGuestSendCommand: [0x7f839c800dd0] Adb connected, start proxing data

PavanBilagi commented 5 years ago

I am also facing the same issue . Is this issue fixed?

Zip already downloaded: /Users/pavanbilagi/.nanoscope/roms/c1sEHfsSLhstgkhc6EcnQQ==... Launching emulator... emulator: autoconfig: -vendor ./vendor.img emulator: autoconfig: -datadir . emulator: Read property file at ./system/build.prop emulator: Cannot find boot properties file: ./boot.prop

emulator: Found target API sdkVersion: 25

emulator: Invalid int property: 'ro.build.version.incremental:eng.leland.20180507.124526' emulator: virtual device config file: ./config.ini emulator: using core hw config path: ./hardware-qemu.ini emulator: using snapshot lock path: ./snapshot.lock emulator: Warning: config.ini contains invalid skin.path entry: (null) emulator: Target arch = 'x86' emulator: Auto-config: -qemu -cpu qemu32 emulator: Auto-detect: Kernel image requires legacy device naming scheme. emulator: Auto-detect: Kernel does not support YAFFS2 partitions. emulator: Using initial system image: ./system.img emulator: Using initial vendor image: ./vendor.img emulator: autoconfig: -initdata ./userdata.img emulator: autoconfig: -cache ./cache.img emulator: autoconfig: -sdcard ./system.img emulator: Physical RAM size: 1024MB

emulator: System image is read only emulator: Found 4 DNS servers: 10.1.0.1 192.177.0.1 115.112.18.21 8.8.8.8 emulator: trying to load skin file '/Users/pavanbilagi/Library/Android/sdk/skins/pixel/layout' emulator: GPU emulation enabled using 'host' mode emulator: Initializing hardware OpenGLES emulation support emulator: Found 4 DNS servers: 10.1.0.1 192.177.0.1 115.112.18.21 8.8.8.8 emulator: WARNING: Classic qemu does not support SMP. The hw.cpu.ncore option from your config file is ignored. Content of hardware configuration file: hw.cpu.arch = x86 hw.cpu.model = qemu32 hw.cpu.ncore = 4 hw.ramSize = 1024 hw.screen = multi-touch hw.mainKeys = false hw.trackBall = false hw.keyboard = true 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 hw.sdCard.path = ./system.img disk.cachePartition = true disk.cachePartition.path = ./cache.img disk.cachePartition.size = 66m test.quitAfterBootTimeOut = -1 hw.lcd.width = 1080 hw.lcd.height = 1920 hw.lcd.depth = 16 hw.lcd.density = 480 hw.lcd.backlight = true hw.gpu.enabled = true hw.gpu.mode = host hw.gpu.blacklisted = no hw.initialOrientation = Portrait hw.camera.back = emulated hw.camera.front = emulated vm.heapSize = 256 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 = /Users/pavanbilagi/Library/Android/sdk/system-images/android-25/google_apis/x86/kernel-qemu kernel.newDeviceNaming = no kernel.supportsYaffs2 = no disk.ramdisk.path = ./ramdisk.img disk.systemPartition.initPath = ./system.img disk.systemPartition.size = 2056m disk.vendorPartition.initPath = ./vendor.img disk.vendorPartition.size = 2056m disk.dataPartition.path = ././userdata.img disk.dataPartition.size = 2056m PlayStore.enabled = false avd.name = fastboot.forceColdBoot = false . emulator: CPU Acceleration: working emulator: CPU Acceleration status: Hypervisor.Framework OS X Version 10.13 emulator: checking cpu acceleration from main qemu params QEMU options list: emulator: argv[00] = "/Users/pavanbilagi/Library/Android/sdk/emulator/emulator64-x86" emulator: argv[01] = "-dns-server" emulator: argv[02] = "10.1.0.1,192.177.0.1,115.112.18.21,8.8.8.8" emulator: argv[03] = "-serial" emulator: argv[04] = "null" emulator: argv[05] = "-serial" emulator: argv[06] = "null" emulator: argv[07] = "-enable-hax" emulator: argv[08] = "-android-hw" emulator: argv[09] = "./hardware-qemu.ini" emulator: argv[10] = "-append" emulator: argv[11] = "qemu=1 no_timer_check androidboot.hardware=goldfish clocksource=pit no-kvmclock android.qemud=1 console=0 android.checkjni=1 qemu.gles=1 qemu.opengles.version=131072 ndns=4 loop.max_part=7 qemu.dalvik.vm.heapsize=256m" Concatenated QEMU options: /Users/pavanbilagi/Library/Android/sdk/emulator/emulator64-x86 -dns-server 10.1.0.1,192.177.0.1,115.112.18.21,8.8.8.8 -serial null -serial null -enable-hax -android-hw ./hardware-qemu.ini -append 'qemu=1 no_timer_check androidboot.hardware=goldfish clocksource=pit no-kvmclock android.qemud=1 console=0 android.checkjni=1 qemu.gles=1 qemu.opengles.version=131072 ndns=4 loop.max_part=7 qemu.dalvik.vm.heapsize=256m' emulator: Warning: config.ini contains invalid skin.path entry: (null) emulator: Starting QEMU main loop emulator: registered 'boot-properties' qemud service emulator: Using kernel serial device prefix: ttyS emulator: AVD Name: emulator: Ramdisk image contains fstab.goldfish file emulator: Found format of system partition: 'ext4' emulator: Could not extract format of vendor partition! emulator: Found format of userdata partition: 'ext4' emulator: Found format of cache partition: 'ext4' emulator: system partition format: ext4 emulator: nand_add_dev: system,size=0x80800000,file=./system.img,pagesize=512,extrasize=0,readonly emulator: userdata partition format: ext4 emulator: nand_add_dev: userdata,size=0x80800000,file=././userdata.img,pagesize=512,extrasize=0 emulator: cache partition format: ext4 emulator: nand_add_dev: cache,size=0x4200000,file=./cache.img,pagesize=512,extrasize=0 emulator: Adding boot property: 'dalvik.vm.heapsize' = '256m' emulator: Adding boot property: 'qemu.sf.lcd_density' = '480' emulator: Adding boot property: 'qemu.hw.mainkeys' = '0' emulator: Adding boot property: 'qemu.sf.fake_camera' = 'both' emulator: Found 4 DNS servers: 10.1.0.1 192.177.0.1 115.112.18.21 8.8.8.8 emulator: Adding boot property: 'ro.opengles.version' = '131072' emulator: Failed to open the hax module

HAXM is not working and emulator runs in emulation mode emulator: Failed to get HAX capability

emulator: Kernel parameters: qemu=1 no_timer_check androidboot.hardware=goldfish clocksource=pit no-kvmclock android.qemud=1 console=0 android.checkjni=1 qemu.gles=1 qemu.opengles.version=131072 ndns=4 loop.max_part=7 qemu.dalvik.vm.heapsize=256m emulator: trying to find: /Users/pavanbilagi/Library/Android/sdk/emulator/bios.bin

emulator: trying to find: /Users/pavanbilagi/Library/Android/sdk/emulator/lib/pc-bios/bios.bin

emulator: trying to find: /Users/pavanbilagi/Library/Android/sdk/emulator/vgabios-cirrus.bin

emulator: trying to find: /Users/pavanbilagi/Library/Android/sdk/emulator/lib/pc-bios/vgabios-cirrus.bin

emulator: control console listening on port 5554, ADB on port 5555 Not using any http proxy emulator: Adding boot property: 'qemu.timezone' = 'Asia/Kolkata' emulator: android_hw_fingerprint_init: fingerprint qemud listen service initialized

emulator: OpenGL Vendor=[Google (Intel Inc.)] emulator: OpenGL Renderer=[Android Emulator OpenGL ES Translator (Intel Iris Pro OpenGL Engine)] emulator: OpenGL Version=[OpenGL ES 3.0 (4.1 INTEL-10.36.19)] emulator: Warning: config.ini contains invalid skin.path entry: (null) emulator: Warning: config.ini contains invalid skin.path entry: (null) emulator: Warning: config.ini contains invalid skin.path entry: (null) emulator: Warning: config.ini contains invalid skin.path entry: (null) emulator: Warning: config.ini contains invalid skin.path entry: (null) emulator: onGuestSendCommand: [0x7fb17ac143e0] Adb connected, start proxing data

fat-fellow commented 5 years ago

The same for me and when i use haxm i am getting emulator: Trying to vcpu execute at eip: in an infinite loop. In the end an emulator silently fails.

CheerS17 commented 5 years ago

@warabei14 Trying to reinstall the HXAM, the first time it may take a long time to load the emulator, but it will be faster for the following loadings.

ashishb commented 5 years ago

Looking at emulator: Warning: config.ini contains invalid skin.path entry: (null), try with -no-skin. That might fix the issue.

Tagakov commented 5 years ago

In addition to @ashishb reply. Try to remove

-skindir $ANDROID_HOME/skins \
-skin pixel

From ~/.nanoscope/roms/<UID>/emulator.sh

johnjohndoe commented 5 years ago

This issue in the Google bug tracker might be helpful.

Leland-Takamine commented 5 years ago

The latest version of Nanoscope creates a proper AVD with the nanoscope emulator command. Please update to the latest version brew upgrade nanoscope and re-open if this doesn't fix your issue.