AVD manager looses device definitions on eclipse restart

1,721 views
Skip to first unread message

Pierre-Yves Ricau

unread,
Nov 21, 2012, 10:28:58 AM11/21/12
to adt...@googlegroups.com
Hi guys,

I created an AVD with a custom device definition or a talk yesterday. For this kind of demos you need the latest Android, but with a quite small screen definition so that it fits the screen size when using a video projector (as Tor pointed out, one could also rotate the emulator ;) ).


It works, but when I restart Eclipse, the user-created device definition is gone. The AVD is still there, but in a broken state, the "Device" field is not set any more.

I'm using the ADT Bundle 21, on a Mac Book Pro. I can reproduce this systematically.

This was also reproduced on another MacBook Pro, with a standard Eclipse (not the ADT Bundle), with the latest SDK and ADT updates.

Let me know if there's any other information you need.

By the way, it would be nice if we could export / import device definitions. I guess we already can by moving some files, right? Having that within the UI would be a bonus.

Cheers,
Py

Siva Velusamy

unread,
Nov 21, 2012, 4:50:43 PM11/21/12
to adt...@googlegroups.com
User created device definitions are stored in
$HOME/.android/devices.xml. Check the contents of that file once you
create a device. Recently there was another bug someone found where
IntelliJ and Eclipse were both using the same file, but looks like
IntelliJ might've been using an older version. Make sure that is not
the case here.

Pierre-Yves Ricau

unread,
Nov 22, 2012, 10:30:23 AM11/22/12
to adt...@googlegroups.com
Hi,

I do not use IntelliJ. Anyway, you are definitely pointing into the right direction.

ls -alh ~/.android

=> no devices.xml, but two backup files:

-rw-r--r--   1 pyricau  staff   3,2K 19 nov 21:51 devices.xml.old
-rw-r--r--   1 pyricau  staff   2,4K 20 nov 16:41 devices.xml.old.0

I create the new Device definition in Eclipse, and now the devices.xml file gets created: 

-rw-r--r--   1 pyricau  staff   2,4K 22 nov 11:27 devices.xml

I exit Eclipse and the restart it, and I don't have any devices.xml file any more.

-rw-r--r--   1 pyricau  staff   3,2K 19 nov 21:51 devices.xml.old
-rw-r--r--   1 pyricau  staff   2,4K 20 nov 16:41 devices.xml.old.0
-rw-r--r--   1 pyricau  staff   2,4K 22 nov 11:25 devices.xml.old.1

Basically it seems that on restart of Eclipse the devices.xml file is changed into a backup file...

This happens with the APT Bundle as well as with a standard Eclipse with APT plugin.




2012/11/21 Siva Velusamy <vs...@google.com>



--
Pierre-Yves Ricau


Michael Wright

unread,
Nov 22, 2012, 7:35:09 PM11/22/12
to adt...@googlegroups.com
This happens when the device file fails to be parsed, just in case it's the old device definition which might still have information you want, so there's likely an issue with the XML that ADT is generating. Could you post the devices.xml file that's created and maybe the options you're selecting when creating the device?

Thanks

Michael

Pierre-Yves Ricau

unread,
Nov 23, 2012, 1:53:55 PM11/23/12
to adt...@googlegroups.com
The options I select are the ones you can see on this screenshot: https://twitter.com/Piwai/status/270632454535147521/photo/1

Here comes the content of devices.xml: https://gist.github.com/ebed7f85e400b497005c

Something noticeable in the content:

<d:diagonal-length>3,70</d:diagonal-length>

and

<d:xdpi>203,98</d:xdpi>
<d:ydpi>203,98</d:ydpi>

The XML contains commas instead of dots to separate the decimal part. I really entered "3.7" in the UI, and the XML contains "3,7".

ADT is in English, Eclipse is in English too, but my OS (Mac OS X) is in French. And we french use commas to separate the decimal part :) .





2012/11/22 Michael Wright <mdwr...@ncsu.edu>

Mark Murphy

unread,
Nov 23, 2012, 2:18:11 PM11/23/12
to adt...@googlegroups.com
On Fri, Nov 23, 2012 at 8:53 AM, Pierre-Yves Ricau <py.r...@gmail.com> wrote:
> The options I select are the ones you can see on this screenshot:
> https://twitter.com/Piwai/status/270632454535147521/photo/1
>
> Here comes the content of devices.xml:
> https://gist.github.com/ebed7f85e400b497005c
>
> Something noticeable in the content:
>
> <d:diagonal-length>3,70</d:diagonal-length>
>
> and
>
> <d:xdpi>203,98</d:xdpi>
> <d:ydpi>203,98</d:ydpi>
>
> The XML contains commas instead of dots to separate the decimal part. I
> really entered "3.7" in the UI, and the XML contains "3,7".
>
> ADT is in English, Eclipse is in English too, but my OS (Mac OS X) is in
> French. And we french use commas to separate the decimal part :) .

Somebody else (assuming it is not you!) is reporting the same behavior:

http://stackoverflow.com/questions/13530675/avd-manager-loses-user-created-device-definitions-after-closing-and-reopening-it

--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Här kan du ställa och svara på frågor om applikationsutveckling på
Android: http://www.andglobe.com

Pierre-Yves Ricau

unread,
Nov 23, 2012, 2:24:35 PM11/23/12
to adt...@googlegroups.com
It's not me :) . As you pointed out in the comments, this must be a locale problem :) 

2012/11/23 Mark Murphy <mmu...@commonsware.com>

Somebody else (assuming it is not you!) is reporting the same behavior:

Tor Norbye

unread,
Nov 23, 2012, 5:21:14 PM11/23/12
to adt...@googlegroups.com
Sounds like somebody is using String#format without specifying Locale.US as the first parameter. Incidentally we have a lint check for that now in 21 to find similar bugs in Android code :-)

-- Tor

Tor Norbye

unread,
Nov 23, 2012, 5:23:41 PM11/23/12
to adt...@googlegroups.com
Yeah, this looks suspicious:
DeviceWriter.java
139:                String.format("%.2f",s.getDiagonalLength()));
151:        addElement(doc, screen, DeviceSchema.NODE_XDPI, String.format("%.2f", s.getXdpi()));
152:        addElement(doc, screen, DeviceSchema.NODE_YDPI, String.format("%.2f", s.getYdpi()));

Tor Norbye

unread,
Nov 23, 2012, 5:35:35 PM11/23/12
to adt...@googlegroups.com

Pierre-Yves Ricau

unread,
Nov 23, 2012, 5:50:59 PM11/23/12
to adt...@googlegroups.com
@Marco Tor just fixed it :) . 

2012/11/23 Marco Di Ianni <diiann...@gmail.com>
Same story here!

Tor Norbye

unread,
Nov 23, 2012, 5:55:51 PM11/23/12
to adt...@googlegroups.com
Hi actually posted those many hours ago, I only now got to the moderator queue and approved the pending messages.  (We have this group set up to send all new posts from new senders to the moderator queue.)

-- Tor

Tor Norbye

unread,
Nov 30, 2012, 6:10:22 PM11/30/12
to adt...@googlegroups.com
We're about to release a 21.0.1 Preview which includes this fix. If you need an immediate workaround, try running Eclipse in the C locale.

-- Tor


On Fri, Nov 30, 2012 at 6:54 AM, Cyril Real <cyril...@gmail.com> wrote:
Newbie question : how to include Tor's fix in my installed SDK ? :)

Raphaël Moll

unread,
Dec 1, 2012, 3:51:43 AM12/1/12
to adt...@googlegroups.com
FYI we pushed "Tools 21.0.1 preview 1" to the SDK repository. This should have the fix that Tor mentioned.
If you don't know how to get the preview, see http://tools.android.com/preview-channel
R/
Message has been deleted

Cyril Real

unread,
Dec 7, 2012, 10:43:20 AM12/7/12
to adt...@googlegroups.com
Thank you guys !
:-)

Tor Norbye

unread,
Jan 15, 2013, 3:06:28 PM1/15/13
to adt...@googlegroups.com
First, note that this bug is supposed to be fixed in 21.0.1, not just 21.1 Preview, so you should be able to get it via the update center. (The update center itself had an issue which meant that 21.0.1 was not offered until this week, even though it has been available as part of the ADT 21 Bundle download for a while now.)

Second, it's a very common issue to install the 21.0.1 or 21.1 Preview bits via the SDK manager and believe that you have 21.0.1 -- but we actually have two *separate* update mechanisms, and you have to use both:
SDK manager for Tools 21 and Platform Tools 16
The Eclipse Update Site for the ADT plugin
Each one updates a separate part of the product, and unfortunately there isn't a way to get either one to install the other.

What we should do however is use our dependencies to require updating the other. ADT has a way to say that it depends on Tools version X. We've been careful to not update this flag unless there really is some new feature in the Tools that ADT depends on, and vice versa. However, it's pretty clear that a lot of people will update tools without the other, so I think we should instead use this to trigger people to update both. 

Any objections?

-- Tor


On Mon, Jan 14, 2013 at 10:11 PM, Martin L. <marti...@gmail.com> wrote:
Well, I installed the preview and the bug still exists. When I add a new user created device there are "," stored in the devices.xml instead of "." :(

On Friday, December 7, 2012 11:43:20 AM UTC+1, Cyril Real wrote:
Thank you guys !
:-)

Reply all
Reply to author
Forward
0 new messages