xamarin 窗体android模拟器无法在Visual Studio中启动

ih99xse1  于 2023-08-01  发布在  Android
关注(0)|答案(2)|浏览(209)

我在Visual Studio中从Android设备管理器启动Android模拟器Nexus 5时遇到问题,我试图启用Hyper-V,AEHD和HAXM,但它不起作用。由于某种原因,我没有看到模拟器在“adb设备”,也当我启动它,我不能停止它从Android设备管理器。
我试图按照微软故障排除,但它没有帮助,我不能通过CMD启动模拟器“emulator -avd avd_name [ {-option [value]}...]”,我也试图重新安装SDK,但没有帮助。当我开始调试与模拟器它刚刚开始部署和进度条出现,但它冻结在那里,我等了1小时,但什么也没有发生。你知道我该怎么解决吗
下面是日志文件的开始:

[23-07-13 16.15.38.75] Android Device Manager version 17.6.0.76-HEAD@aca9c0a
[23-07-13 16.15.38.75] Build date: 12.7.2023. 14.24.53
[23-07-13 16.15.38.75] Operating system: Windows 10 v10.0.19045 (Windows 10 Pro; Microsoft Windows 10 v10.0.19045 (Windows 10 Pro; 64-bit)), 64-bit
[23-07-13 16.15.38.75] Run arguments: "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\Extensions\Xamarin\AndroidDeviceManager\AndroidDevices.exe" android-registry=SOFTWARE\Xamarin\VisualStudio\17.0_4a684485\Android mono-android-path="C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Xamarin\Android" log-path="<USER_HOME>\AppData\Local\Xamarin\Logs\17.0" vs-pid=12052 vs_version=17.6 p=7cbf9e92-6396-4a99-9c0c-dc5b99175070 telemetry_session="{\"IsOptedIn\":true,\"HostName\":\"Dev14\",\"AppInsightsInstrumentationKey\":\"f144292e-e3b2-4011-ac90-20e5c03fbce5\",\"AsimovInstrumentationKey\":\"AIF-312cbd79-9dbb-4c48-a7da-3cc2a931cb70\",\"CollectorApiKey\":\"f3e86b4023cc43f0be495508d51f588a-f70d0e59-0fb0-4473-9f19-b4024cc340be-7296\",\"AppId\":1001,\"UserId\":\"1526062c-98b6-45f0-a17a-9b12d89a4411\",\"Id\":\"6dedc337-fbee-4b74-af8a-f463976f4f11\",\"ProcessStartTime\":638248613028280328,\"SkuName\":\"VS_Community\",\"VSExeVersion\":\"17.6.33829.357\",\"BucketFiltersToEnableWatsonForFaults\":[{\"AdditionalProperties\":[],\"Id\":\"53126781-21df-4995-bac8-6c850c7c1efb\",\"WatsonEventType\":\"VisualStudioMemWatson\",\"BucketParameterFilters\":[\"(?i)perfwatsonstarvation\",null,null,null,null,null,null,null,null,null]}],\"BucketFiltersToAddDumpsToFaults\":[{\"AdditionalProperties\":[{\"Key\":\"DumpType\",\"Value\":\"Heap\"}],\"Id\":\"e9940337-2ead-49ca-8069-098d308bf8c0\",\"WatsonEventType\":\"VisualStudioNonFatalErrors2\",\"BucketParameterFilters\":[null,null,\"vs.fault.faulttest\",null,null,null,null,null,null,null]}]}" 
[23-07-13 16.15.38.80] [AppInfo] Detected Android SDK path: C:\Program Files (x86)\Android\android-sdk
[23-07-13 16.15.38.83] --- Device Manager started
[23-07-13 16.15.38.93] Window_LocationChanged
    [23-07-13 16.15.39.03] No Android SDK instance matching the 'C:\Program Files (x86)\Android\android-sdk' path
    [23-07-13 16.15.39.56] Xamarin manifest base URL: https://aka.ms/xamarin/sdkmanifest/
    [23-07-13 16.15.39.57] Parsing: platform tools
    [23-07-13 16.15.39.58] Parsing: tools
    [23-07-13 16.15.39.58] No elements of this kind found
    [23-07-13 16.15.39.58] Parsing: cmdline-tools
    [23-07-13 16.15.39.58] Parsing: build tools
    [23-07-13 16.15.39.58] Parsing: emulators
    [23-07-13 16.15.39.58] Parsing: NDK
    [23-07-13 16.15.39.58] Parsing: LLDB
    [23-07-13 16.15.39.58] No elements of this kind found
    [23-07-13 16.15.39.58] Parsing: patchers
    [23-07-13 16.15.39.58] Parsing: platforms
    [23-07-13 16.15.39.58] Parsing: system images
    [23-07-13 16.15.39.60] Parsing: addons
    [23-07-13 16.15.39.60] Parsing: extras
    [23-07-13 16.15.39.60] Detecting Android SDK in 'C:\Program Files (x86)\Android\android-sdk'
    [23-07-13 16.15.39.61] Detecting component Android SDK Platform-Tools r34.0.3 in directory 'C:\Program Files (x86)\Android\android-sdk\platform-tools'
    [23-07-13 16.15.39.61]   Found revision 34.0.3 on the system
    [23-07-13 16.15.39.61] Detecting component Android SDK Platform-Tools r34.0.1 in directory 'C:\Program Files (x86)\Android\android-sdk\platform-tools'
    [23-07-13 16.15.39.61]   Found revision 34.0.3 on the system
    [23-07-13 16.15.39.61] Detecting component Android SDK Platform-Tools r33.0.3 in directory 'C:\Program Files (x86)\Android\android-sdk\platform-tools'
    [23-07-13 16.15.39.62]   Found revision 34.0.3 on the system
    [23-07-13 16.15.39.62] Detecting component Android SDK Platform-Tools r33.0.2 in directory 'C:\Program Files (x86)\Android\android-sdk\platform-tools'
    [23-07-13 16.15.39.62]   Found revision 34.0.3 on the system
    [23-07-13 16.15.39.62] Detecting component Android SDK Command-line Tools r7.0 in directory 'C:\Program Files (x86)\Android\android-sdk\cmdline-tools/7.0'
    [23-07-13 16.15.39.62]   Found revision 7.0 on the system
    [23-07-13 16.15.39.62] Component Android SDK Command-line Tools r6.0 not present on the system
    [23-07-13 16.15.39.62] Component Android SDK Command-line Tools r5.0 not present on the system
    [23-07-13 16.15.39.62] Component Android SDK Build-Tools 33.0.2 r33.0.2 not present on the system
    [23-07-13 16.15.39.62] Component Android SDK Build-Tools 33.0.1 r33.0.1 not present on the system
    [23-07-13 16.15.39.62] Component Android SDK Build-Tools 33 r33.0.0 not present on the system
    [23-07-13 16.15.39.62] Detecting component Android SDK Build-Tools 32 r32.0.0 in directory 'C:\Program Files (x86)\Android\android-sdk\build-tools/32.0.0'
    [23-07-13 16.15.39.62]   Found revision 32.0.0 on the system
    [23-07-13 16.15.39.62] Component Android SDK Build-Tools 31 r31.0.0 not present on the system
    [23-07-13 16.15.39.62] Component Android SDK Build-Tools 30.0.3 r30.0.3 not present on the system
    [23-07-13 16.15.39.62] Component Android SDK Build-Tools 30.0.2 r30.0.2 not present on the system
    [23-07-13 16.15.39.62] Detecting component Android Emulator r32.1.14 in directory 'C:\Program Files (x86)\Android\android-sdk\emulator'
    [23-07-13 16.15.39.62]   Found revision 32.1.14 on the system
    [23-07-13 16.15.39.62] Detecting component Android Emulator r32.1.14 in directory 'C:\Program Files (x86)\Android\android-sdk\emulator'
    [23-07-13 16.15.39.62]   Found revision 32.1.14 on the system
    [23-07-13 16.15.39.62] Detecting component Android Emulator r32.1.14 in directory 'C:\Program Files (x86)\Android\android-sdk\emulator'
    [23-07-13 16.15.39.62]   Found revision 32.1.14 on the system
    [23-07-13 16.15.39.62] Detecting component NDK r22.1.7171670 in directory 'C:\Program Files (x86)\Android\android-sdk\ndk-bundle'
    [23-07-13 16.15.39.62]   Found revision 20.1.5948944 on the system
    [23-07-13 16.15.39.62] Detecting component NDK r22.0.7026061 in directory 'C:\Program Files (x86)\Android\android-sdk\ndk-bundle'
    [23-07-13 16.15.39.62]   Found revision 20.1.5948944 on the system
    [23-07-13 16.15.39.62] Detecting component NDK r21.4.7075529 in directory 'C:\Program Files (x86)\Android\android-sdk\ndk-bundle'
    [23-07-13 16.15.39.62]   Found revision 20.1.5948944 on the system
    [23-07-13 16.15.39.62] Detecting component NDK r21.3.6528147 in directory 'C:\Program Files (x86)\Android\android-sdk\ndk-bundle'
    [23-07-13 16.15.39.62]   Found revision 20.1.5948944 on the system
    [23-07-13 16.15.39.62] Detecting component NDK r21.2.6472646 in directory 'C:\Program Files (x86)\Android\android-sdk\ndk-bundle'
    [23-07-13 16.15.39.62]   Found revision 20.1.5948944 on the system
    [23-07-13 16.15.39.62] Detecting component NDK r21.1.6352462 in directory 'C:\Program Files (x86)\Android\android-sdk\ndk-bundle'
    [23-07-13 16.15.39.62]   Found revision 20.1.5948944 on the system
    [23-07-13 16.15.39.62] Detecting component NDK r21.0.6113669 in directory 'C:\Program Files (x86)\Android\android-sdk\ndk-bundle'
    [23-07-13 16.15.39.62]   Found revision 20.1.5948944 on the system
    [23-07-13 16.15.39.62] Detecting component NDK r20.1.5948944 in directory 'C:\Program Files (x86)\Android\android-sdk\ndk-bundle'
    [23-07-13 16.15.39.62]   Found revision 20.1.5948944 on the system
    [23-07-13 16.15.39.62] Detecting component NDK r20.0.5594570 in directory 'C:\Program Files (x86)\Android\android-sdk\ndk-bundle'
    [23-07-13 16.15.39.62]   Found revision 20.1.5948944 on the system
    [23-07-13 16.15.39.63] Detecting component NDK r19.2.5345600 in directory 'C:\Program Files (x86)\Android\android-sdk\ndk-bundle'
    [23-07-13 16.15.39.63]   Found revision 20.1.5948944 on the system
    [23-07-13 16.15.39.63] Detecting component NDK r19.0.5232133 in directory 'C:\Program Files (x86)\Android\android-sdk\ndk-bundle'
    [23-07-13 16.15.39.63]   Found revision 20.1.5948944 on the system
    [23-07-13 16.15.39.63] Detecting component NDK r18.1.5063045 in directory 'C:\Program Files (x86)\Android\android-sdk\ndk-bundle'
    [23-07-13 16.15.39.63]   Found revision 20.1.5948944 on the system
    [23-07-13 16.15.39.63] Detecting component NDK r17.2.4988734 in directory 'C:\Program Files (x86)\Android\android-sdk\ndk-bundle'
    [23-07-13 16.15.39.63]   Found revision 20.1.5948944 on the system
    [23-07-13 16.15.39.63] Detecting component NDK r16.1.4479499 in directory 'C:\Program Files (x86)\Android\android-sdk\ndk-bundle'
    [23-07-13 16.15.39.63]   Found revision 20.1.5948944 on the system
    [23-07-13 16.15.39.63] Detecting component NDK r14.1.3816874 in directory 'C:\Program Files (x86)\Android\android-sdk\ndk-bundle'
    [23-07-13 16.15.39.63]   Found revision 20.1.5948944 on the system
    [23-07-13 16.15.39.63] Component NDK (Side by side) 22.1.7171670 r22.1.7171670 not present on the system
    [23-07-13 16.15.39.63] Component NDK (Side by side) 22.0.7026061 r22.0.7026061 not present on the system
    [23-07-13 16.15.39.63] Component NDK (Side by side) 21.4.7075529 r21.4.7075529 not present on the system
    [23-07-13 16.15.39.63] Component NDK (Side by side) 21.3.6528147 r21.3.6528147 not present on the system
    [23-07-13 16.15.39.63] Component NDK (Side by side) 21.2.6472646 r21.2.6472646 not present on the system
    [23-07-13 16.15.39.63] Component NDK (Side by side) 21.1.6352462 r21.1.6352462 not present on the system
    [23-07-13 16.15.39.63] Component NDK (Side by side) 21.0.6113669 r21.0.6113669 not present on the system
    [23-07-13 16.15.39.63] Component NDK (Side by side) 20.1.5948944 r20.1.5948944 not present on the system
[23-07-13 16.15.39.63] Component NDK (Side by side) 20.0.5594570 r20.0.5594570 not present on the system

字符串
下面是日志文件的结尾:

[23-07-13 16.23.13.92] Going to stop nexus_5_-_api_23
[23-07-13 16.23.13.92] [AvdInfo.Stop] Enter
[23-07-13 16.23.13.93] [EmulatorManager.Stop] Enter. EmulatorName:
[23-07-13 16.23.13.93] AVDStatusToButtonTextConverter [Convert]Stop
[23-07-13 16.23.13.93] AVDStatusToButtonTextConverter [Convert]Stop
[23-07-13 16.23.13.93] AVDStatusToButtonTextConverter [Convert]Stop
[23-07-13 16.23.13.93] [EmulatorManager.Stop] AVDNamenexus_5_-_api_23
[23-07-13 16.23.13.93] [GetEmulatorNameRunningAvd]:+ avdNamenexus_5_-_api_23
[23-07-13 16.23.13.93] [ProcessStartInfoAsInvoker] Executing command: "C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe" "devices"
[23-07-13 16.23.13.98] [EmulatorManager.Stop] EmulatorName is: 
[23-07-13 16.23.13.98] [ProcessStartInfoAsInvoker] Executing command: "C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe" "devices"
[23-07-13 16.23.14.02] [GetEmulatorNameRunningAvd]:+ avdNamenexus_5_-_api_23
[23-07-13 16.23.14.02] [ProcessStartInfoAsInvoker] Executing command: "C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe" "devices"
[23-07-13 16.23.14.49] [ProcessStartInfoAsInvoker] Executing command: "C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe" "devices"
[23-07-13 16.23.14.58] [GetEmulatorNameRunningAvd]:+ avdNamenexus_5_-_api_24
[23-07-13 16.23.14.58] [ProcessStartInfoAsInvoker] Executing command: "C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe" "devices"


当我通过CMD启动它时,我得到了这个:

Microsoft Windows [Version 10.0.19045.3208]
(c) Microsoft Corporation. All rights reserved.

C:\WINDOWS\system32>emulator -avd nexus_5_-_api_23
INFO    | Android emulator version 32.1.14.0 (build_id 10330179) (CL:N/A)
INFO    | Found systemPath C:\Program Files (x86)\Android\android-sdk\system-images\android-23\google_apis\x86\
INFO    | Storing crashdata in: C:\Users\Miroslav\AppData\Local\Temp\\AndroidEmulator\emu-crash.db, detection is enabled
INFO    | Duplicate loglines will be removed, if you wish to see each indiviudal line launch with the -log-nofilter flag.
INFO    | IPv4 server found: 109.122.99.130
C:\Program Files (x86)\Android\android-sdk\emulator\qemu\windows-x86_64\qemu-system-i386.exe: -usbdevice tablet: '-usbdevice' is deprecated, please use '-device usb-...' instead
HAX is working and emulator runs in fast virt mode.
C:\Program Files (x86)\Android\android-sdk\emulator\qemu\windows-x86_64\qemu-system-i386.exe: -drive format=raw,file=cat:C:\Users\Miroslav\.android\avd\nexus_5_-_api_23.avd\system.img.qcow2|C:\Users\Miroslav\.android\avd\nexus_5_-_api_23.avd\userdata-qemu.img.qcow2|C:\Users\Miroslav\.android\avd\nexus_5_-_api_23.avd\vendor.img.qcow2: cat driver can't open backing file C:\Users\Miroslav\.android\avd\nexus_5_-_api_23.avd\vendor.img.qcow2


在该路径中找不到vendor.img.qcow2

56lgkhnf

56lgkhnf1#

您可以从以下几个方面解决问题:
1.删除模拟器并创建一个新的模拟器,然后重试。
2.如果问题仍然存在,请重新检查您是否正确设置了Android SDK。
有关详细信息,请查看文档:Setting up the Android SDK for Xamarin.Android的数据。
3.修复你的Visual Studio
有关详细信息,请查看文档:Repair Visual Studio

70gysomp

70gysomp2#

我找到了一种方法来启动模拟器右键单击.Droid项目文件和属性部分我看到编译使用Android版本设置为Anroid 8.1(奥利奥),我下载了模拟器与x86为基础的架构Nexus 5手机,我仍然有问题,显示任何模拟器,我只是有空白屏幕.我也得到了vendor.img.qcow2文件的模拟器,所以我可以复制到其他版本,他们的工作,然后也显示黑色sreen。
现在,当我键入“adb devices”命令时,我得到:

List of devices attached
emulator-5554   offline

字符串
我在CMD中有这个:

D:\Xamarin\xamarin-forms-book-samples\Chapter02\Hello\Hello\Hello>emulator -avd nexus_5_-_api_27
INFO    | Android emulator version 32.1.14.0 (build_id 10330179) (CL:N/A)
INFO    | Found systemPath C:\Program Files (x86)\Android\android-sdk\system-images\android-27\google_apis_playstore\x86\
INFO    | Storing crashdata in: C:\Users\Miroslav\AppData\Local\Temp\\AndroidEmulator\emu-crash.db, detection is enabled
INFO    | Duplicate loglines will be removed, if you wish to see each indiviudal line launch with the -log-nofilter flag.
INFO    | IPv4 server found: 109.122.99.130
C:\Program Files (x86)\Android\android-sdk\emulator\qemu\windows-x86_64\qemu-system-i386.exe: -usbdevice tablet: '-usbdevice' is deprecated, please use '-device usb-...' instead
HAX is working and emulator runs in fast virt mode.
dsound: Could not initialize DirectSoundCapture
dsound: Reason: No sound driver is available for use, or the given GUID is not a valid DirectSound device ID
WARNING | *** No gRPC protection active, consider launching with the -grpc-use-jwt flag.***
INFO    | Started GRPC server at 127.0.0.1:8554, security: Local, auth: none
INFO    | Advertising in: C:\Users\Miroslav\AppData\Local\Temp\avd\running\pid_17036.ini
Attempt to initialize voice without DirectSoundCapture object
Attempt to initialize voice without DirectSoundCapture object
Failed to create voice `adc'

相关问题