ADT eclipse xml layout text editor - often broken until file closed and reopened [duplicate]

这一生的挚爱 提交于 2019-12-04 22:42:05

FOUND AN EASY WAY TO DISABLE THE BUG!! (WORKAROUND)

Window > Preferences > Android > Editors > Untick "Format XML files using the standard..." (1st option)

Then, just do Ctrl + Shift + F to Auto-format your XML to Eclipse Built-In convention. You should not be getting the bug at all.

I had this problem my self, when the xml editor does this "thing" go to source->cleanup document, I kept the checkboxes on the dialog at their default (all checked except "convert line delimiters to...") and press ok.

that solved it for me. hope it helps.

I had the same problem. What I did was deleted Eclipse and ADT. Then upgraded to Juno. The new combination seemd to fix it for me. I think its a problem with the new ADT and Indigo.

Chandrashekhar

I also had same problem and I think closing the file and opening it after clean again is the only solution.

I have found that this problem is only with Eclipse Indigo.

Working solution for me is to convert line delimiters to Unix (LF, \n, 0A) for the xml layout file. (File > Convert Line Del. To > Unix) This need to be done only once. I didn't change default line ending in settings.

The ADT is not messing up the code any longer, and while editing xml manually, eclipse is smart enough to use Unix new line character for this file even if I have windows new line character set as default.

Origin of the problem:

The problem was that ADT inserted wrong new line characters. Eg. there was "\r\n\r\r\n" between the lines of code. Notice the double \r character.

When using Unix new line char (\r) only, as line delimiter, ADT is working properly. I also noticed better performance while working in "Graphical layout", and there are no extra unnecessary empty lines between xml elements.

So I guess there is bug in both ADT and Eclipse, ADT is inseting wrong line endings and Eclipse freaks out because of that.

One thing that sometimes works for me is to do Ctrl+A, Ctrl+C, Ctrl+V. Basically, select all, copy, and paste. It sounds strange, but it usually fixes the problem without having to do anything particularly time consuming.

It looks like an issue of Android or Eclipse ADT...see below links...

http://code.google.com/p/android/issues/detail?id=30529

https://bugs.eclipse.org/bugs/show_bug.cgi?id=375421

for solve this problem update your ADT to letest version.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!