incorrect line ending: found carriage return (\r) without corresponding newline (\n)

I got this error message in one of my Android layout files (some API library that I downloaded from the web) thought there was no syntax error in that line number that displayed this error. So this was something to do with a carriage return and newline character mismatch.

Solution :

Way's to resolve this issue for ADT Eclipse,

1. Cut the content of the file using Command + X (macOS)/ Ctrl + X (Windows).

2. And Just Paste the content back to the file : Command + V (Mac OS X)/ Ctrl + V (Windows).

Update :

It seems like when you Format the code using Command + Shift + F (Mac OS X)/ Ctrl + Shift + F (Windows) also does the trick.

Recent Posts:

Code2care is an initiative to publish and share varied knowledge in programming and technical areas gathered during day-to-day learnings and development activities.

Students and Software Developers can leverage this portal to find solutions to their various queries without re-inventing the wheel by referring to our easy to understand posts. Technical posts might include Learnings, Video Tutorials, Code Snippets, How Tos, Blogs, Articles, etc.