Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

New emulator in AVD manager gives "no longer exists as a device"

I've been struggling with creating a new emulator with the AVD manager in the latest Android build tools. I can create a device profile and an emulator using it, but it immediately appears in the AVD manager as broken with an option to "Repair Device".

AVD manager gives "Repair Device"

Attempting to repair the device or wiping the data has no effect. This occurs on any kind of new emulator, including preset device profiles.

The exact error:

Name: Android_Wear_Round_API_23

CPU/ABI: Android Wear Intel Atom (x86)

Path: C:\Users\Developer.android\avd\Android_Wear_Round_API_23.avd

Error: User Android Wear Round no longer exists as a device

I'm using:

  • Android Studio 2.2.1
  • Android SDK tools 25.2.2
  • Android SDK platform tools 24.0.4
like image 324
Paul Lammertsma Avatar asked Oct 18 '16 16:10

Paul Lammertsma


1 Answers

This problem occurs when the AVD manager is looking for a hardware profile and can't find it, even though it exists. I have a feeling that this is caused by a bug in the latest tools that cause hardware profiles to be saved without a proper id, because profiles made a while ago are still working correctly (until you edit them). The following fixed it for me:

In your user profile folder, find devices.xml inside the ~/.android folder, so on Windows you'd look for C:\Users\Me\.android\devices.xml.

Open the file and look for a device with the name that shows in the error message, in your case 'Android Wear Round'. It'll look like this:

    <d:device>
        <d:name>Android Wear Round</d:name>
        ...

Duplicate the line with the name and change the tag to d:id, but keep the name, like so:

    <d:device>
        <d:name>Android Wear Round</d:name>
        <d:id>Android Wear Round</d:id>
        ...

Return to the AVD manager and hit refresh; the virtual device should be repaired now.

like image 71
Mathijs Avatar answered Nov 14 '22 22:11

Mathijs