7
votes

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
3

3 Answers

8
votes

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.

0
votes

All of a sudden some of my emulators showed this issue (5/9 emulators). It seems like those emulators that had issues were created using a custom hardware profile which was imported separately. And for some reason, the imported hardware profile was no longer available when I was trying to create a new emulator with those hardware profiles. So I reimported those Hardware profiles and all the emulator that showed error started working as usual.

0
votes

Pre-req: Set ANDROID_HOME to a location where valid android sdk is available , if on windows C:\Users****\AppData\Local\Android\Sdk

Recreate scenario:On running %ANDROID_HOME%\tools\android.bat list avd, you should either observe "no-longer-exists as a device" or this would list valid devices.

Possibility 1: devices.xml is missing in c:\users\.android\devices.xml is missing, invalid (cannot be parsed). This can be restored from %ANDROID_HOME%\tools\lib\devices.xml

Possibility 2: Device name on devices.xml and device name present in config.ini of emulator. Open AVD manager, click on edit and copy Device name. Update restored devices.xml with this name.

Ensure config.ini under c:\users\.android\avd\.avd\ has identical entry as a value for the key hw.device.name