Strange xml error: Incorrect line ending

前端 未结 15 513
臣服心动
臣服心动 2021-02-01 13:42

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&am

相关标签:
15条回答
  • 2021-02-01 14:30

    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

    0 讨论(0)
  • 2021-02-01 14:30

    Maybe you need to put /> at the end,

    Try this:

    android:layout_height="wrap_content"/>   
    
    0 讨论(0)
  • 2021-02-01 14:36

    The best way to do it is to use lint through Android layout editor, and use the "fix" button.

    0 讨论(0)
  • 2021-02-01 14:38

    Try cleaning the project:

    Project -> Clean... -> Clean All

    It worked for me. Hope it helps.

    0 讨论(0)
  • 2021-02-01 14:41

    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)

    0 讨论(0)
  • 2021-02-01 14:42

    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

    0 讨论(0)
提交回复
热议问题