I haven't used Eclipse since 1 week ago. Today I started it and I noticed that it loaded slowly. When it was started it prompted this:
http://tinypic.com?ref=2zpk1g2" target="_blank"><img src="http://i48.tinypic.com/2zpk1g2.png" border="0" alt="Image and video hosting by TinyPic"></a>">
I thougth that maybe Eclipse has updated something of Android so I updated to the newest ADT. Now I have the same error but I have an extra big error that I don't know if it's because the previous error. I have tried the new feature of look how an xml layer looks in many devices. I have tried with 2 layers and now the program doesn't compiles because it says:
Incorrect line ending: found carriage return (\r) without corresponding newline (\n)
The error for one xml is in this line:
android:layout_height="wrap_content">
and the other one is in:
android:orientation="horizontal">
wtf has happened? I didn't change anything nor saved it and 1 week ago all was fine.
I just got the same annoying problem. What I did was copying the entire code into notepad. Then from notepad, paste it back into the xml field. I know, it sounds stupid, but it worked and I have no idea why -__-"
Simple solution:
Press: Ctrl + Shift + F and then save. It's a matter of formatting. This will format it.
As Tor says here, this is because they have solved the problem of "transparent" lines in xml, that weird error that when you click one line you were in another.
As also he says, if you have this error is because you had files that can cause this "transparent" error so:
Simply open up the file and invoke Ctrl-1; that will show the available quickfixes, and there's a quickfix for this line warning which will go and clean up the line endings in the given file.
(Click over the error, press ctrl+1, you will see the fix)
This is a very funny problem that I am also facing. The solution is simple. Just try out following on same page.
Ctrl+A, Ctrl+X, then Ctrl+V
Happy coding.
Go to Preference -> Android -> Lint Error checking, then search for ID = MangledCRLF, change its severity below "error". This will fix the problem for the error - "Incorrect line ending: found carriage return (\r) without corresponding newline (\n)"
Try cleaning the project:
Project -> Clean... -> Clean All
It worked for me. Hope it helps.
The best way to do it is to use lint through Android layout editor, and use the "fix" button.
My solution to the Android SDK/ADT 21 xml layout error.
Incorrect line ending: found carriage return (\r) without corresponding newline (\n)
Example:
<TextView
android:id="@+id/text1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
/>from here...
Marking the space between the tags after where you get the error and hit enter and then ctrl s (save) removes it.
...to here<
<TextView
android:id="@+id/text2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
update: if it's only one line between the tags, set the marker there and press ctrl+d (delete) and the ctrl+s (save)
Just Go to --> window option and than click clear option and ok.
Incorrect line ending: found carriage return (\r) without corresponding newline (\n).
It is because you have commented few portions of the code. Remove that code and save. This thing worked for me.
This is one of the best solution to change your Lint settings for permanent fix Click here
OR
Do this
Go to windows-> Preference -> Android -> Lint Error checking, then search for ID = MangledCRLF, change its severity below "error" to "warning". It will fix your problem
One more possible solution is, to format the layout xml file which lead to this error. If you are using eclipse then use short cut Ctrl+i and save the file. With this you should be able to get rid off this error for that particular file permanently
just cut and paste. It will work.
Here is the solution what I came across
Solution 1: - Open layout file Ctrl+Shift+F (Command+Shift+F in MacOSX) Save the layout file and close it. Delete any .out files the builder might have created. Clean project.
Solution 2: - Also you can select the complete code, cut it and then paste it again. This will not disturb your xml formatting as well.
Solution 3: For few of the coders it works just after cleaning the project
Hope this will help. Please do let me know if I can be of any help
Maybe you need to put /> at the end,
Try this:
android:layout_height="wrap_content"/>
来源:https://stackoverflow.com/questions/13400684/strange-xml-error-incorrect-line-ending