Xamarin.Forms项目不会启动Android模拟器

时间:2019-03-10 04:43:21

标签: android xamarin.forms visual-studio-2017

我已经从模板创建了一个Blank(或Master-Detail,或Tabbed-无关紧要)Xamarin.Forms项目。该项目已在Visual Studio中加载,我尝试以Debug模式(使用Android_Accelerated_x86_Oreo(Android 8.1 - API 27))运行它,但失败。

这是“输出”窗口:

Starting runtime checks
Starting emulator Android_Accelerated_x86_Oreo ...
C:\Program Files (x86)\Android\android-sdk\emulator\emulator.EXE -partition-size 512 -no-boot-anim -verbose -feature WindowsHypervisorPlatform -avd Android_Accelerated_x86_Oreo -prop monodroid.avdname=Android_Accelerated_x86_Oreo
1>------ Build started: Project: App3, Configuration: Debug Any CPU ------
emulator: Android virtual device file at: C:\Users\willi\.android\avd\Android_Accelerated_x86_Oreo.ini
emulator: virtual device content at C:\Users\willi\.android\avd\Android_Accelerated_x86_Oreo.avd
emulator: virtual device config file: C:\Users\willi\.android\avd\Android_Accelerated_x86_Oreo.avd/config.ini
emulator: using core hw config path: C:\Users\willi\.android\avd\Android_Accelerated_x86_Oreo.avd/hardware-qemu.ini
emulator: using snapshot lock path: C:\Users\willi\.android\avd\Android_Accelerated_x86_Oreo.avd/snapshot.lock
emulator: Found AVD target API level: 27
emulator: Read property file at C:\Program Files (x86)\Android\android-sdk/system-images\android-27\google_apis\x86\/build.prop
emulator: No boot.prop property file found.
emulator: 'magic' skin format detected: 768x1280
emulator: autoconfig: -skin 768x1280
emulator: autoconfig: -skindir (null)
emulator: autoconfig: -kernel C:\Program Files (x86)\Android\android-sdk/system-images\android-27\google_apis\x86\/kernel-ranchu-64
emulator: Target arch = 'x86'
emulator: Auto-config: -qemu -cpu qemu32
emulator: Auto-detect: Kernel image requires new device naming scheme.
emulator: Auto-detect: Kernel does not support YAFFS2 partitions.
emulator: autoconfig: -ramdisk C:\Program Files (x86)\Android\android-sdk/system-images\android-27\google_apis\x86\/ramdisk.img
emulator: Using initial system image: C:\Program Files (x86)\Android\android-sdk/system-images\android-27\google_apis\x86\/system.img
emulator: Using initial vendor image: C:\Program Files (x86)\Android\android-sdk/system-images\android-27\google_apis\x86\/vendor.img
emulator: autoconfig: -data C:\Users\willi\.android\avd\Android_Accelerated_x86_Oreo.avd/userdata-qemu.img
emulator: autoconfig: -initdata C:\Users\willi\.android\avd\Android_Accelerated_x86_Oreo.avd/userdata.img
emulator: autoconfig: -cache C:\Users\willi\.android\avd\Android_Accelerated_x86_Oreo.avd/cache.img
emulator: autoconfig: -sdcard C:\Users\willi\.android\avd\Android_Accelerated_x86_Oreo.avd/sdcard.img
emulator: Increasing RAM size to 1024MB
emulator: VM heap size 64MB is below hardware specified minimum of 256MB,setting it to that value
emulator: System image is read only
emulator: Found 4 DNS servers: 192.168.0.1 fec0:0:0:ffff::1 fec0:0:0:ffff::2 fec0:0:0:ffff::3
emulator: [FeatureControl] Feature 'WindowsHypervisorPlatform' (14) state set to enabled
emulator: found magic skin width=768 height=1280 bpp=16
emulator: Checking whether Windows Hypervisor Platform (WHPX) is available.
emulator: WinHvPlatform.dll found. Looking for WHvGetCapability...
emulator: WHvGetCapability found. Querying WHPX capabilities...
emulator: WHPX (10.0.18342) is installed and usable.
emulator: CPU Acceleration: working
emulator: CPU Acceleration status: WHPX (10.0.18342) is installed and usable.
emulator: 'magic' skin format detected: 768x1280
emulator: GPU emulation enabled using 'host' mode
emulator: Initializing hardware OpenGLES emulation support
emulator: Found 4 DNS servers: 192.168.0.1 fec0:0:0:ffff::1 fec0:0:0:ffff::2 fec0:0:0:ffff::3
Content of hardware configuration file:
  hw.cpu.arch = x86
  hw.cpu.model = qemu32
  hw.cpu.ncore = 2
  hw.ramSize = 1024
  hw.screen = multi-touch
  hw.mainKeys = true
  hw.trackBall = true
  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 = C:\Users\willi\.android\avd\Android_Accelerated_x86_Oreo.avd/sdcard.img
  disk.cachePartition = true
  disk.cachePartition.path = C:\Users\willi\.android\avd\Android_Accelerated_x86_Oreo.avd/cache.img
  disk.cachePartition.size = 66m
  test.quitAfterBootTimeOut = -1
  hw.lcd.width = 768
  hw.lcd.height = 1280
  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 = C:\Program Files (x86)\Android\android-sdk/system-images\android-27\google_apis\x86\/kernel-ranchu-64
  kernel.newDeviceNaming = yes
  kernel.supportsYaffs2 = no
  disk.ramdisk.path = C:\Program Files (x86)\Android\android-sdk/system-images\android-27\google_apis\x86\/ramdisk.img
  disk.systemPartition.initPath = C:\Program Files (x86)\Android\android-sdk/system-images\android-27\google_apis\x86\/system.img
  disk.systemPartition.size = 2562m
  disk.vendorPartition.initPath = C:\Program Files (x86)\Android\android-sdk/system-images\android-27\google_apis\x86\/vendor.img
  disk.vendorPartition.size = 512m
  disk.dataPartition.path = C:\Users\willi\.android\avd\Android_Accelerated_x86_Oreo.avd/userdata-qemu.img
  disk.dataPartition.size = 512m
  disk.encryptionKeyPartition.path = C:\Users\willi\.android\avd\Android_Accelerated_x86_Oreo.avd/encryptionkey.img
  PlayStore.enabled = false
  avd.name = Android_Accelerated_x86_Oreo
  fastboot.forceColdBoot = false
.
QEMU options list:
emulator: argv[00] = "C:\Program Files (x86)\Android\android-sdk\emulator/qemu/windows-x86_64/qemu-system-x86_64.exe"
emulator: argv[01] = "-dns-server"
emulator: argv[02] = "192.168.0.1,fec0:0:0:ffff::1,fec0:0:0:ffff::2,fec0:0:0:ffff::3"
emulator: argv[03] = "-serial"
emulator: argv[04] = "null"
emulator: argv[05] = "-boot-property"
emulator: argv[06] = "monodroid.avdname=Android_Accelerated_x86_Oreo"
emulator: argv[07] = "-device"
emulator: argv[08] = "goldfish_pstore,addr=0xff018000,size=0x10000,file=C:\Users\willi\.android\avd\Android_Accelerated_x86_Oreo.avd\data\misc\pstore\pstore.bin"
emulator: argv[09] = "-cpu"
emulator: argv[10] = "android64"
emulator: argv[11] = "-enable-whpx"
emulator: argv[12] = "-smp"
emulator: argv[13] = "cores=2"
emulator: argv[14] = "-m"
emulator: argv[15] = "1024"
emulator: argv[16] = "-lcd-density"
emulator: argv[17] = "480"
emulator: argv[18] = "-nodefaults"
emulator: argv[19] = "-kernel"
emulator: argv[20] = "C:\Program Files (x86)\Android\android-sdk/system-images\android-27\google_apis\x86\/kernel-ranchu-64"
emulator: argv[21] = "-initrd"
emulator: argv[22] = "C:\Program Files (x86)\Android\android-sdk/system-images\android-27\google_apis\x86\/ramdisk.img"
emulator: argv[23] = "-drive"
emulator: argv[24] = "if=none,index=0,id=system,file=C:\Program Files (x86)\Android\android-sdk/system-images\android-27\google_apis\x86\/system.img,read-only"
emulator: argv[25] = "-device"
emulator: argv[26] = "virtio-blk-pci,drive=system,modern-pio-notify"
emulator: argv[27] = "-drive"
emulator: argv[28] = "if=none,index=1,id=cache,file=C:\Users\willi\.android\avd\Android_Accelerated_x86_Oreo.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,modern-pio-notify"
emulator: argv[31] = "-drive"
emulator: argv[32] = "if=none,index=2,id=userdata,file=C:\Users\willi\.android\avd\Android_Accelerated_x86_Oreo.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,modern-pio-notify"
emulator: argv[35] = "-drive"
emulator: argv[36] = "if=none,index=3,id=encrypt,file=C:\Users\willi\.android\avd\Android_Accelerated_x86_Oreo.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,modern-pio-notify"
emulator: argv[39] = "-drive"
emulator: argv[40] = "if=none,index=4,id=vendor,file=C:\Program Files (x86)\Android\android-sdk/system-images\android-27\google_apis\x86\/vendor.img,read-only"
emulator: argv[41] = "-device"
emulator: argv[42] = "virtio-blk-pci,drive=vendor,modern-pio-notify"
emulator: argv[43] = "-drive"
emulator: argv[44] = "if=none,index=5,id=sdcard,file=C:\Users\willi\.android\avd\Android_Accelerated_x86_Oreo.avd/sdcard.img.qcow2,overlap-check=none,cache=unsafe,l2-cache-size=1048576"
emulator: argv[45] = "-device"
emulator: argv[46] = "virtio-blk-pci,drive=sdcard,modern-pio-notify"
emulator: argv[47] = "-netdev"
emulator: argv[48] = "user,id=mynet"
emulator: argv[49] = "-device"
emulator: argv[50] = "virtio-net-pci,netdev=mynet"
emulator: argv[51] = "-device"
emulator: argv[52] = "virtio-rng-pci"
emulator: argv[53] = "-show-cursor"
emulator: argv[54] = "-L"
emulator: argv[55] = "C:\Program Files (x86)\Android\android-sdk\emulator/lib/pc-bios"
emulator: argv[56] = "-soundhw"
emulator: argv[57] = "hda"
emulator: argv[58] = "-vga"
emulator: argv[59] = "none"
emulator: argv[60] = "-append"
emulator: argv[61] = "qemu=1 no_timer_check androidboot.hardware=ranchu clocksource=pit no-kvmclock android.qemud=1 console=0 android.checkjni=1 android.bootanim=0 qemu.gles=1 qemu.encrypt=1 qemu.opengles.version=196609 qemu.uirenderer=skiagl cma=272M@0-4G ndns=4 qemu.wifi=1 mac80211_hwsim.channels=2 androidboot.android_dt_dir=/sys/bus/platform/devices/ANDR0001:00/properties/android/ loop.max_part=7 ramoops.mem_address=0xff018000 ramoops.mem_size=0x10000 memmap=0x10000$0xff018000 qemu.dalvik.vm.heapsize=256m"
emulator: argv[62] = "-android-hw"
emulator: argv[63] = "C:\Users\willi\.android\avd\Android_Accelerated_x86_Oreo.avd/hardware-qemu.ini"
Concatenated QEMU options:
qemu-system-x86_64.exe: WHPX: Failed to create partition, hr=80070005 "C:\Program Files (x86)\Android\android-sdk\emulator/qemu/windows-x86_64/qemu-system-x86_64.exe" -dns-server 192.168.0.1,fec0:0:0:ffff::1,fec0:0:0:ffff::2,fec0:0:0:ffff::3 -serial null -boot-property monodroid.avdname=Android_Accelerated_x86_Oreo -device goldfish_pstore,addr=0xff018000,size=0x10000,file=C:\Users\willi\.android\avd\Android_Accelerated_x86_Oreo.avd\data\misc\pstore\pstore.bin -cpu android64 -enable-whpx -smp cores=2 -m 1024 -lcd-density 480 -nodefaults -kernel "C:\Program Files (x86)\Android\android-sdk/system-images\android-27\google_apis\x86\/kernel-ranchu-64" -initrd "C:\Program Files (x86)\Android\android-sdk/system-images\android-27\google_apis\x86\/ramdisk.img" -drive "if=none,index=0,id=system,file=C:\Program Files (x86)\Android\android-sdk/system-images\android-27\google_apis\x86\/system.img,read-only" -device virtio-blk-pci,drive=system,modern-pio-notify -drive if=none,index=1,id=cache,file=C:\Users\willi\.android\avd\Android_Accelerated_x86_Oreo.avd/cache.img.qcow2,overlap-check=none,cache=unsafe,l2-cache-size=1048576 -device virtio-blk-pci,drive=cache,modern-pio-notify -drive if=none,index=2,id=userdata,file=C:\Users\willi\.android\avd\Android_Accelerated_x86_Oreo.avd/userdata-qemu.img.qcow2,overlap-check=none,cache=unsafe,l2-cache-size=1048576 -device virtio-blk-pci,drive=userdata,modern-pio-notify -drive if=none,index=3,id=encrypt,file=C:\Users\willi\.android\avd\Android_Accelerated_x86_Oreo.avd/encryptionkey.img.qcow2,overlap-check=none,cache=unsafe,l2-cache-size=1048576 -device virtio-blk-pci,drive=encrypt,modern-pio-notify -drive "if=none,index=4,id=vendor,file=C:\Program Files (x86)\Android\android-sdk/system-images\android-27\google_apis\x86\/vendor.img,read-only" -device virtio-blk-pci,drive=vendor,modern-pio-notify -drive if=none,index=5,id=sdcard,file=C:\Users\willi\.android\avd\Android_Accelerated_x86_Oreo.avd/sdcard.img.qcow2,overlap-check=none,cache=unsafe,l2-cache-size=1048576 -device virtio-blk-pci,drive=sdcard,modern-pio-notify -netdev user,id=mynet -device virtio-net-pci,netdev=mynet -device virtio-rng-pci -show-cursor -L "C:\Program Files (x86)\Android\android-sdk\emulator/lib/pc-bios" -soundhw hda -vga none -append "qemu=1 no_timer_check androidboot.hardware=ranchu clocksource=pit no-kvmclock android.qemud=1 console=0 android.checkjni=1 android.bootanim=0 qemu.gles=1 qemu.encrypt=1 qemu.opengles.version=196609 qemu.uirenderer=skiagl cma=272M@0-4G ndns=4 qemu.wifi=1 mac80211_hwsim.channels=2 androidboot.android_dt_dir=/sys/bus/platform/devices/ANDR0001:00/properties/android/ loop.max_part=7 ramoops.mem_address=0xff018000 ramoops.mem_size=0x10000 memmap=0x10000$0xff018000 qemu.dalvik.vm.heapsize=256m" -android-hw C:\Users\willi\.android\avd\Android_Accelerated_x86_Oreo.avd/hardware-qemu.ini

failed to initialize WHPX: Invalid argumentemulator: Android qemu version 27.3.9.0 (build_id 4899998) (CL:e7b1c928a596dd490b990f4532055950f1409e49)

emulator: Starting QEMU main loop
emulator: registered 'boot-properties' qemud service
emulator: Adding boot property: 'ro.opengles.version' = '196609'
emulator: Adding boot property: 'qemu.sf.fake_camera' = 'both'
emulator: Adding boot property: 'dalvik.vm.heapsize' = '256m'
emulator: Adding boot property: 'qemu.hw.mainkeys' = '1'
emulator: Adding boot property: 'qemu.sf.lcd_density' = '480'
emulator: Done with QEMU main loop
emulator: User-config was not changed.
emulator: Android emulator version 27.3.9.0 (build_id 4899998) (CL:e7b1c928a596dd490b990f4532055950f1409e49)
emulator: Found AVD name 'Android_Accelerated_x86_Oreo'
emulator: Found AVD target architecture: x86
emulator: argv[0]: 'C:\Program Files (x86)\Android\android-sdk\emulator\emulator.EXE'; program directory: 'C:\Program Files (x86)\Android\android-sdk\emulator'
emulator:  Found directory: C:\Program Files (x86)\Android\android-sdk/system-images\android-27\google_apis\x86\
emulator: Probing for C:\Program Files (x86)\Android\android-sdk/system-images\android-27\google_apis\x86\/kernel-ranchu-64: file exists
emulator: Auto-config: -engine qemu2 (based on configuration)
Emulator Android_Accelerated_x86_Oreo cannot be started.emulator:  Found directory: C:\Program Files (x86)\Android\android-sdk/system-images\android-27\google_apis\x86\
emulator: emuDirName: 'C:\Program Files (x86)\Android\android-sdk\emulator'
Runtime checks completedemulator:  Found directory: C:\Program Files (x86)\Android\android-sdk/system-images\android-27\google_apis\x86\
emulator: Probing for C:\Program Files (x86)\Android\android-sdk/system-images\android-27\google_apis\x86\/kernel-ranchu-64: file exists
emulator: try dir C:\Program Files (x86)\Android\android-sdk\emulator
emulator: Trying emulator path 'C:\Program Files (x86)\Android\android-sdk\emulator/qemu/windows-x86_64/qemu-system-x86_64.exe'
emulator: Found target-specific 64-bit emulator binary: C:\Program Files (x86)\Android\android-sdk\emulator/qemu/windows-x86_64/qemu-system-x86_64.exe
emulator: Adding library search path: 'C:\Program Files (x86)\Android\android-sdk\emulator/lib64'
emulator: Adding library search path: 'C:\Program Files (x86)\Android\android-sdk\emulator/lib64/gles_swiftshader'
emulator: Adding library search path: 'C:\Program Files (x86)\Android\android-sdk\emulator/lib64/gles_angle'
emulator: Adding library search path: 'C:\Program Files (x86)\Android\android-sdk\emulator/lib64/gles_angle9'
emulator: Adding library search path: 'C:\Program Files (x86)\Android\android-sdk\emulator/lib64/gles_angle11'
emulator: Adding library search path for Qt: 'C:\Program Files (x86)\Android\android-sdk\emulator\lib64\qt\lib'
emulator: Setting Qt plugin search path: QT_QPA_PLATFORM_PLUGIN_PATH=C:\Program Files (x86)\Android\android-sdk\emulator\lib64\qt\plugins
emulator: Setting Qt to use software OpenGL: QT_OPENGL=software
emulator: Quoted param: ["C:\Program Files (x86)\Android\android-sdk\emulator/qemu/windows-x86_64/qemu-system-x86_64.exe"]
emulator: Quoted param: [-partition-size]
emulator: Quoted param: [512]
emulator: Quoted param: [-no-boot-anim]
emulator: Quoted param: [-verbose]
emulator: Quoted param: [-feature]
emulator: Quoted param: [WindowsHypervisorPlatform]
emulator: Quoted param: [-avd]
emulator: Quoted param: [Android_Accelerated_x86_Oreo]
emulator: Quoted param: [-prop]
emulator: Quoted param: [monodroid.avdname=Android_Accelerated_x86_Oreo]
emulator: Running :C:\Program Files (x86)\Android\android-sdk\emulator/qemu/windows-x86_64/qemu-system-x86_64.exe
emulator: qemu backend: argv[00] = ""C:\Program Files (x86)\Android\android-sdk\emulator/qemu/windows-x86_64/qemu-system-x86_64.exe""
emulator: qemu backend: argv[01] = "-partition-size"
emulator: qemu backend: argv[02] = "512"
emulator: qemu backend: argv[03] = "-no-boot-anim"
emulator: qemu backend: argv[04] = "-verbose"
emulator: qemu backend: argv[05] = "-feature"
emulator: qemu backend: argv[06] = "WindowsHypervisorPlatform"
emulator: qemu backend: argv[07] = "-avd"
emulator: qemu backend: argv[08] = "Android_Accelerated_x86_Oreo"
emulator: qemu backend: argv[09] = "-prop"
emulator: qemu backend: argv[10] = "monodroid.avdname=Android_Accelerated_x86_Oreo"
emulator: Concatenated backend parameters:
 '"C:\Program Files (x86)\Android\android-sdk\emulator/qemu/windows-x86_64/qemu-system-x86_64.exe"' -partition-size 512 -no-boot-anim -verbose -feature WindowsHypervisorPlatform -avd Android_Accelerated_x86_Oreo -prop monodroid.avdname=Android_Accelerated_x86_Oreo
Build has been canceled. 

我不了解Xamarin.Forms的第一件事-我只是将脚趾放在这里,默认项目甚至无法运行。

修改

我试图通过在适当的目录中运行emulator.EXE -partition-size 512 -no-boot-anim -verbose -feature WindowsHypervisorPlatform -avd Android_Accelerated_x86_Oreo -prop monodroid.avdname=Android_Accelerated_x86_Oreo来手动运行仿真器,并在很长的输出流的底部出现了此错误:

qemu-system-x86_64.exe: WHPX: Failed to create partition, hr=80070005
failed to initialize WHPX: Invalid argument
emulator: Done with QEMU main loop
emulator: User-config was not changed.

如果有人认为有帮助,我可以附加完整的输出。

**编辑2 **

我试图使用设备管理器启动仿真器,并且在启动时我得到了这个提示:

Gboard has stopped

2 个答案:

答案 0 :(得分:0)

此问题与Xamarin无关,如果创建本机Android应用程序,则会在Windows 10计算机上遇到相同的问题。

这是一个已报告给GoogleMicrosoft的“错误”。

似乎是用户权限问题。以管理员身份运行Visual Studio或手动制作的命令应该可以解决该问题。

答案 1 :(得分:0)

咨询了一些Xamarin专家之后,最简单的解决方法是转到工具-> Android-> Android设备管理器,然后编辑设备定义以删除Google Play商店:

enter image description here

我尝试了一下,一切都变得像魅惑一样。