'Failed to open /qemu.conf, err: 2

I got this error while using windows command prompt to connect a android virtual device to visual studio code. However opens the android virtual device but still says no connected devices when run the flutter doctor command. please help to use a android virtual device for visual studio code.



Solution 1:[1]

This error occur because there is a query for file in C:\qemu.conf path.

If you create a blank file the warning Failed to open /qemu.conf, err: 2 will desapear.

But in my tests, I needed to run as an administrator. (about this, look to the first comments above. Thanks for trick, Maikon Matheus)

This is the log in ProcessMonitor of Sysinternals:

ProcessMonitor of Sysinternals

Create the file with this command:

echo # > c:\qemu.conf

cmd.exe output

Solution 2:[2]

This issue is resolved by Cold Boot, the command emulator -avd <avd_name> -no-snapshot-load, execute this on command prompt or terminal on Linux.

Make sure that emulator is added to system PATH.

Solution 3:[3]

You have to fulfil android emulator requirements based on your system.

Android emulator requirements: https://developer.android.com/studio/run/emulator#requirements

My problem was missing this requirement:

reHAXM 6.2.1 or later (HAXM 7.2.0 or later recommended)

Solution was to go in Tools -> SDK Manager, and check Intel (HAXM installer) option.

enter image description here

Solution 4:[4]

I got the same error and problem after updating flutter and android studio. After updating my emulator didn't work correctly , it was asking me to use androidx when I ran "flutter run" command in vs code terminal . later I found this link to migrate my app to android x https://flutter.dev/docs/development/androidx-migration , this will provide you all the steps to do it.After doing that android studio will ask to update some more plugins please do it. Still you'll be getting the same error when opening your emulator using the cmd but the emulator will work fine and when you run flutter doctor it will show device connected.please make sure to run flutter doctor after running the emulator else it will show as not connected. Hope you understood what I said

Solution 5:[5]

I also have exactly the same issue after updating Android SDK and Emulator to the latest version. And it doesn't look like it is related to Flutter (but I actually have it installed too). I posted this bug on issuetracker.google.com and provided all the logs. Hope they'll manage to help... P.S. I'll notify if they'll provide any solution.

Solution 6:[6]

I had the same error when ran

D:\Android>emulator -avd AndroidDevice01

The Problem was solved when I started cmd.exe with Administrative privileging!

Solution 7:[7]

I tried almost all the solutions presented. For me the emulator only came back after I restarted the PC.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 sitholewb
Solution 3 Aidas K
Solution 4 Tharik Rizan
Solution 5 tuo
Solution 6 Leon Rom
Solution 7 Felipe Leo