17

I have been coping with an annoying "bug" in eclipse (android) for some time, and today it has just annoyed me to much! So I was wondering has anyone else come accross it, and have you found a fix for it?

It's hard to explain, so hopefully these three screen caps will help:

The first screenshot, everything is ok.

Screen 1 - Everything is ok

The second screenshot, after a simple click everything moves around.

Screen 2 - A simple click, notice how lines have duplicated and moved

The third screenshot, another click and things move again.

Screen 3 - Another click, things move again

Closing the file and opening it again seams to solve the problem for a while, but it's really annoying!

Has anyone come across this, or a fix for it?

--EDIT

Forgot to mention, I am running:

  • Eclipse 4.2.0 64-Bit (on Windows 7)
  • ADT 20
melodiouscode
  • 2,105
  • 1
  • 20
  • 41
  • 1
    Wow, that looks annoying! What version of eclipse and ADT are you on? Mac? Windows? I have had no end of troubles with the latest 'Juno' version doing wierd and wonderful things. About to go back to indigo til it is a little more stable. – Ben Neill Sep 02 '12 at 11:45
  • Oops forgot to say! Have updated the question with details. Although I have had this problem since I started with android dev (about 6 months ago). Since then I have had a full rebuild of my machine. The problem also occurred in indigo before I up'd to Juno! – melodiouscode Sep 02 '12 at 11:51
  • I still prefer Exlipse 3.x over 4.x... maybe an eclipse downgrade works.. – WarrenFaith Sep 02 '12 at 11:54
  • this looks like the same issue... you seen/tried the fix here? http://stackoverflow.com/questions/10826791/adt-eclipse-xml-layout-text-editor-often-broken-until-file-closed-and-reopened – Ben Neill Sep 02 '12 at 11:55
  • 2
    oh, and here... http://stackoverflow.com/questions/10030727/moving-and-vanishing-lines-of-code-trouble-with-eclipses-xml-editor - probably safe to call this a duplicate! – Ben Neill Sep 02 '12 at 12:01
  • Looks like I have caused a duplicate. Although none of them have been answered! As this question is getting a fair bit of foot fall I will test out the suggested answers and copy the working one to here before flagging as a duplicate. – melodiouscode Sep 02 '12 at 12:05
  • see my answer, flagged as duplicate. – melodiouscode Sep 02 '12 at 12:52
  • HOLY CRAPOLA! This is sooo freaking annoying. Google & Android we write the buggiest bugs in the world! – Kevin Parker May 07 '14 at 05:16

2 Answers2

2

This is a known bug and happens if you edit the layout in the visual editor and then switch back to the xml editor. You can sometimes fix it by scrolling up and down the file or selecting all the text. Otherwise, just close and reopen the xml file when switching from visual editor to xml editor. It's annoying and still happens to me even after several updates to ADT.

Edit:

I have since found a better solution. In Eclipse go to Window->Preferences. Then under Android->Editors uncheck "Automatically format the XML edited by the visual layout editor". This should solve the problem. You can always auto-format the code manually by pressing Ctrl+Shift+F.

Jimbali
  • 2,065
  • 1
  • 20
  • 24
0

As some commentators have mentioned it seems that this is a duplicate (have flagged as such), although as it is a hard issue to describe that is no surprise! I have tried an answer from one of the questions and it seems to solve the problem. Although it does not prevent the issue!

Community
  • 1
  • 1
melodiouscode
  • 2,105
  • 1
  • 20
  • 41