2012年12月6日 星期四

Eclipse更新後出現錯誤(Incorrect line ending: found carriage return (\r) without corresponding newline (\n))

今天更新後,在xml出現這個錯誤
Incorrect line ending: found carriage return (\r) without corresponding newline (\n)
使用更新前的版本卻沒有出錯,後來找到了解決方法

 原本的寫法
 <LinearLayout    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@drawable/gradient_white"
    android:orientation="vertical" >

後來改成
 <LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@drawable/gradient_white"
    android:orientation="vertical" >

這樣子就解決了,推測更新的版本要求每個xml指令,必須換行才能正確執行

另一種方法更有效,Ctrl+Shift+F  按下後,儲存即可

4 則留言:

所有的訊息,都會親自看過而且回覆