开发者问题收集

使用 Visual Studio 构建 [ProjectName].Android Xamarin.Forms 应用程序时,模拟器卡在手机正在启动屏幕上

2020-04-30
2556

我正尝试在 Visual Studio 的模拟器上构建和测试我的 Xamarin.Forms Android 应用程序 模拟器卡在屏幕上

模拟器卡住

屏幕出现以下消息一次,单击 等待 后,它再次开始显示 手机正在启动

在此处输入图像描述

提到了构建输出下面,

2>Starting deployment to pixel_2_pie_9_0_api_28 ...
2>Starting emulator pixel_2_pie_9_0_api_28 ...
2>Checking HAXM compatibility.
2>Installing HAXM...
2>HAXM installer not found: C:\Program Files (x86)\Android\android-sdk\extras\intel\Hardware_Accelerated_Execution_Manager\silent_install.bat
2>Running non-accelerated
2>C:\Program Files (x86)\Android\android-sdk\emulator\emulator.EXE -no-boot-anim -no-accel -avd pixel_2_pie_9_0_api_28 -prop monodroid.avdname=pixel_2_pie_9_0_api_28
2>Warning: Quick Boot / Snapshots not supported on this machine. A CPU with EPT + UG features is currently needed. We will address this in a future release.
2>emulator: WARNING: x86 emulation may not work without hardware acceleration!
2>emulator: WARNING: Not all modern X86 virtualization features supported, which introduces problems with slowdown when running Android on multicore vCPUs. Setting AVD to run with 1 vCPU core only.
2>Failed to open /usr/local/google/home/joshuaduong/emu/master/prebuilts/android-emulator-build/qemu-android-deps/windows_msvc-x86_64/qemu.conf, err: 2
2>dsound: Could not initialize DirectSoundCapture
2>dsound: Reason: No sound driver is available for use, or the given GUID is not a valid DirectSound device ID
2>dsound: Attempt to initialize voice without DirectSoundCapture object
2>dsound: Attempt to initialize voice without DirectSoundCapture object
2>audio: Failed to create voice `goldfish_audio_in'
2>C:\Program Files (x86)\Android\android-sdk\emulator\qemu\windows-x86_64\qemu-system-x86_64.exe: warning: opening audio input failed
2>dsound: Attempt to initialize voice without DirectSoundCapture object
2>dsound: Attempt to initialize voice without DirectSoundCapture object
2>audio: Failed to create voice `adc'
2>emulator: INFO: QtLogger.cpp:68: Critical: Uncaught TypeError: Cannot read property 'update' of undefined (qrc:/html/js/location-mock-web-channel.js:130, (null))
2>emulator: INFO: boot completed
2>emulator: INFO: boot time 829388 ms
2>emulator: Increasing screen off timeout, logcat buffer size to 2M.
2>emulator: Revoking microphone permissions for Google App.

更新

在从设备管理器单独启动模拟器并构建 Android 解决方案后,我发现了下图中给出的消息。

在此处输入图像描述

这是显示的输出:

2>Starting deployment to pixel_2_pie_9_0_api_28 ...
2>Starting emulator pixel_2_pie_9_0_api_28 ...
2>C:\Program Files (x86)\Android\android-sdk\emulator\emulator.EXE -no-boot-anim -avd pixel_2_pie_9_0_api_28 -prop monodroid.avdname=pixel_2_pie_9_0_api_28
2>emulator: ERROR: Running multiple emulators with the same AVD is an experimental feature.
2>Please use -read-only flag to enable this feature.
2>Emulator pixel_2_pie_9_0_api_28 cannot be started.
========== Build: 1 succeeded, 0 failed, 17 up-to-date, 0 skipped ==========
========== Deploy: 0 succeeded, 1 failed, 0 skipped ==========

但是在部署错误弹出窗口中单击“是”或“否”后,输出窗口中仍然没有错误。

2个回答

回答我自己的问题。

第一个问题与 HAXM 有关,它未安装。

然后关于部署错误,在我的情况下,模拟器的名称已从 Android 设备管理器中的默认名称更改。所以我将其改回默认名称,即添加新设备(例如 Nexus 5X)时给出的名称。

它适用于我的情况,然后花了很长时间才构建和部署!

Jay Bhiyani
2020-04-30

就我而言,我必须重置模拟器。 步骤:

  1. 在 Visual Studio 中打开 Android 设备管理器。
  2. 打开菜单并从恢复出厂设置开始。 就这样,效果很好。

在 Visual Studio 中恢复 Android 设备管理器出厂设置

Shaahin
2020-10-26