Search code examples
androidxamarinadbvisual-studio-2019qemu

Android emulator doesn't work: Failed to open /qemu.conf, No accelerator found and more


Visual Studio Xamarin has problems again. I currently have a Windows Pro 10.0.19043 and the latest version of Visual Studio 2019 (16.10.4) with following components:

Microsoft Visual Studio Enterprise 2019
Version 16.10.4
VisualStudio.16.Release/16.10.4+31515.178
Microsoft .NET Framework
Version 4.8.04084
Installed Version: Enterprise
Microsoft Visual C++ 2019
ASP.NET and Web Tools 2019   16.10.526.50910
ASP.NET and Web Tools 2019
Azure App Service Tools v3.0.0   16.10.526.50910
Azure App Service Tools v3.0.0
C# Tools   3.10.0-4.21329.37+246ce641f04b67ef017655275d850bf902a8e40f
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Common Azure Tools   1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.
Cookiecutter   16.10.21111.19
Provides tools for finding, instantiating and customizing templates in cookiecutter format.
Extensibility Message Bus   1.2.6 (master@34d6af2)
Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.
IntelliCode Extension   1.0
IntelliCode Visual Studio Extension Detailed Info
Linux Core Dump Debugging   1.0.9.31313
Enables debugging of Linux core dumps.
Microsoft Continuous Delivery Tools for Visual Studio   0.4
Simplifying the configuration of Azure DevOps pipelines from within the Visual Studio IDE.
Microsoft JVM Debugger   1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines
Microsoft Library Manager   2.1.113+g422d40002e.RR
Install client-side libraries easily to any web project
Microsoft MI-Based Debugger   1.0
Provides support for connecting Visual Studio to MI compatible debuggers
Microsoft Visual C++ Wizards   1.0
Microsoft Visual C++ Wizards
Microsoft Visual Studio Tools for Containers   1.2
Develop, run, validate your ASP.NET Core applications in the target environment. F5 your application directly into a container with debugging, or CTRL + F5 to edit & refresh your app without having to rebuild the container.
Microsoft Visual Studio VC Package   1.0
Microsoft Visual Studio VC Package
Mono Debugging for Visual Studio   16.10.15 (552afdf)
Support for debugging Mono processes with Visual Studio.
NuGet Package Manager   5.10.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/
NVIDIA CUDA 11.0 Wizards   11.0
Wizards to create new NVIDIA CUDA projects and source files.
ProjectServicesPackage Extension   1.0
ProjectServicesPackage Visual Studio Extension Detailed Info
Python   16.10.21111.19
Provides IntelliSense, projects, templates, debugging, interactive windows, and other support for Python developers.
Python - Profiling support   16.10.21111.19
Profiling support for Python projects.
Razor (ASP.NET Core)   16.1.0.2122504+13c05c96ea6bdbe550bd88b0bf6cdddf8cde1725
Provides languages services for ASP.NET Core Razor.
SQL Server Data Tools   16.0.62106.24090
Microsoft SQL Server Data Tools
Test Adapter for Boost.Test   1.0
Enables Visual Studio's testing tools with unit tests written for Boost.Test.  The use terms and Third Party Notices are available in the extension installation directory.
Test Adapter for Google Test   1.0
Enables Visual Studio's testing tools with unit tests written for Google Test.  The use terms and Third Party Notices are available in the extension installation directory.
TypeScript Tools   16.0.30429.2002
TypeScript Tools for Microsoft Visual Studio
Visual Basic Tools   3.10.0-4.21329.37+246ce641f04b67ef017655275d850bf902a8e40f
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Visual C++ for Cross Platform Mobile Development (Android)   16.0.31306.167
Visual C++ for Cross Platform Mobile Development (Android)
Visual C++ for Linux Development   1.0.9.31313
Visual C++ for Linux Development
Visual F# Tools   16.10.0-beta.21262.7+1b23bbeda88ea3cb9be9af777f4c99fa8663df81
Microsoft Visual F# Tools
Visual Studio Code Debug Adapter Host Package   1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio
Visual Studio Container Tools Extensions   1.0
View, manage, and diagnose containers within Visual Studio.
Visual Studio Tools for CMake   1.0
Visual Studio Tools for CMake
Visual Studio Tools for Containers   1.0
Visual Studio Tools for Containers
VisualStudio.DeviceLog   1.0
Information about my package
VisualStudio.Foo   1.0
Information about my package
VisualStudio.Mac   1.0
Mac Extension for Visual Studio
Xamarin   16.10.000.234 (d16-10@ecaf29b)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.
Xamarin Designer   16.10.0.115 (remotes/origin/c750fbf1bde3c720d077f51640fe197c6dac7cbe@c750fbf1b)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.
Xamarin Templates   16.10.5 (355b57a)
Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.
Xamarin.Android SDK   11.3.0.4 (d16-10/ae14caf)
Xamarin.Android Reference Assemblies and MSBuild support.
    Mono: b4a3858
    Java.Interop: xamarin/java.interop/d16-10@f39db25
    ProGuard: Guardsquare/proguard/v7.0.1@912d149
    SQLite: xamarin/sqlite/3.35.4@85460d3
    Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-10@c5732a0
Xamarin.iOS and Xamarin.Mac SDK   14.20.0.24 (c4b89cddb)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.

Installed Android platforms: Platforms Android 11 Platforms Android 5

Installed SDK components: Shot 1 Shot 2 Shot 3

However, no matter how much I tried to create virtual devices for different versions of the API, the emulator did not work. When launched from Visual Studio, the emulator loading window simply froze forever (or for a very long time). When launched via the command line, the emulator (C:\Program Files (x86)\Android\android-sdk\tools\emulator.exe) produced this:

PS C:\Program Files (x86)\Android\android-sdk\tools> ./emulator -avd nexus_one_lollipop_5_0_-_api_21 
emulator: WARNING: encryption is off
ANGLE: D3D11: rx::Renderer11::generateConfigs
emulator: INFO: QtLogger.cpp:68: Warning: QMetaObject::connectSlotsByName: No matching signal for on_new_posture_requested(int) ((null):0, (null))


emulator: INFO: QtLogger.cpp:68: Warning: QMetaObject::connectSlotsByName: No matching signal for on_dismiss_posture_selection_dialog() ((null):0, (null))


Failed to open /qemu.conf, err: 2
Incompatible HAX module version 3,requires minimum version 4
No accelerator found.
qemu-system-i386.exe: failed to initialize HAX: Invalid argument

After that, the qemu process hangs forever. It ended only through the kill in the task manager.

The -no-snapshot-load option had no effect on anything. I ran everything as an administrator, I also tried to run it as a simple user - the result is the same.

If I create a С:\qemu.conf file, then the output changes:

emulator: WARNING: encryption is off
ANGLE: D3D11: rx::Renderer11::generateConfigs
emulator: INFO: QtLogger.cpp:68: Warning: QMetaObject::connectSlotsByName: No matching signal for on_new_posture_requested(int) ((null):0, (null))


emulator: INFO: QtLogger.cpp:68: Warning: QMetaObject::connectSlotsByName: No matching signal for on_dismiss_posture_selection_dialog() ((null):0, (null))


qemu-system-i386.exe:/qemu.conf:1: no group defined
emulator: INFO: QtLogger.cpp:68: Warning: QMetaObject::connectSlotsByName: No matching signal for on_posture_valueChanged(int) ((null):0, (null))

After that, the emulator no longer hangs, it just exits immediately after output.

I also want to note that another emulator file (C:\Program Files (x86)\Android\android-sdk\emulator\emulator.exe) produces slightly different output. I do not understand why this is so and what it affects.

PS C:\Program Files (x86)\Android\android-sdk\emulator> ./emulator -avd nexus_one_lollipop_5_0_-_api_21
emulator: WARNING: encryption is off
C:\Program Files (x86)\Android\android-sdk\emulator\qemu\windows-x86_64\qemu-system-i386.exe:/qemu.conf:1: no group defined
PS C:\Program Files (x86)\Android\android-sdk\emulator>
  • I've tried answers from other similar questions, but everything remains the same.
  • I've tried reinstalling the SDK components (uninstalling first, rebooting the PC, then reinstalling it again).
  • I tried to restore VIsual Studio (I don't know what it does, but during the process something was downloaded and installed, and the settings were reset). Before importing the old settings, nothing worked, just like after.

Now I don't know what to do anymore. The next step is reinstalling Windows, but it's too long and boring, it requires a lot of settings - I'm not ready to go for that now.

I haven't used Android development for a long time. It seems that everything worked before, but I can't say how long ago. Perhaps some regular update of some component broke the emulator... And by the way, the project is being assembled successfully. However, I cannot run it on my PC.

Is it possible to fix the problem without reinstalling Windows? How?


Solution

  • The problem in my case turned out to be that Visual Studio does nothing with HAXM. Yes, it was he who caused the main error. If your error output is similar to mine, the important problem lies in HAXM.

    It turns out that installing and uninstalling HAXM from the Android SDK menu (shown in the screenshot in the question) does not mean installing or uninstalling in reality.

    As I said in the question, everything worked for me before, but I did not return to this for a long time. So, I had HAXM installed, but the old version. For some reason, Visual Studio could neither update nor uninstall it. When installing a new version, the old one was not replaced and was considered a priority, so installing the new version without removing the old one did not help.

    If your old HAXM installer (which should uninstall the old HAXM) doesn't work, read on. So, how I fixed the error:

    1. "Removed" HAXM via Android SDK menu.
    2. Checked Device manager for HAXM entry (I did not delete anything here because I did not find it)
    3. Removed old HAXM folder from C:\Windows\System32\DRVSTORE\intelhaxm_*
    4. Launched the broken old HAXM installer to remove HAXM registry keys. Before manual intervention, he did not want to work, citing the absence of some kind of .msi file.
    5. Rebooted PC
    6. I made sure that the old HAXM was removed from the system with the command: C:\Program Files (x86)\Android\android-sdk\emulator> .\emulator-check.exe accel
    7. "Installed" HAXM via Android SDK menu. (At this step, nothing was installed - the command from the previous step still reported that there was no HAXM.)
    8. Installed HAXM from Intel official repository: https://github.com/intel/haxm/releases
    9. With command from step 6, I made sure that HAXM was installed correctly (for example, the output on my PC is shown):
    PS C:\Program Files (x86)\Android\android-sdk\emulator> .\emulator-check.exe accel
    accel:
    0
    HAXM version 7.7.0 (4) is installed and usable.
    accel
    

    After that, emulator should work. Perhaps Android Device Manager will glitch showing that the device emulator is already running (but I did not find qemu* and emulator processes). Probably, this can be solved more accurately, but I just deleted the existing device and created it again.