2013-04-04 31 views
5

我遇到了一個煩人的問題。我在我的Android項目中使用了一個片段,這給我帶來了無盡的痛苦,因爲我每次編輯我的主要xml文件時都必須清理項目。這是它的外觀:每次編輯XML文件時都必須在Eclipse中清理整個Android項目

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"> 
    <fragment xmlns:map="http://schemas.android.com/apk/res-auto" 
     android:id="@+id/map" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_alignParentTop="true" 
     android:layout_alignParentLeft="true" 
     class="com.google.android.gms.maps.MapFragment" 
     map:uiRotateGestures="false" 
     map:uiScrollGestures="false" 
     map:uiZoomControls="false" 
     map:uiZoomGestures="false" 
     map:cameraZoom="18" 
     /> 
    <ScrollView 
     android:id="@+id/scroller" 
     android:layout_width="250dp" 
     android:layout_height="100dp" 
     android:layout_alignParentTop="true" 
     android:layout_alignParentLeft="true" 
     android:background="@android:color/white"> 
    <TextView 
     android:id="@+id/debug_text" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:textSize="10sp" 

     /> 
    </ScrollView> 
</RelativeLayout> 

如果我編輯這個文件,即使一個字符開頭的每一行的「地圖」得到用紅色突出顯示,並打開標籤片段被強調爲好。我得到的錯誤是:

Unexpected namespace prefix "xmlns" found for tag fragment 

並與開始的行「地圖」的錯誤是:

Unexpected namespace prefix "map" found for tag fragment 

如果我清理項目,問題消失,我可以建立並運行項目很好,但現在我正在編輯它很多,這是非常非常煩人的。請有人幫忙嗎?

回答

5

在Eclipse中,你可以去項目 - >自動生成應該包括一個乾淨的過程。您也可以使用adb構建ANT腳本,並使用build.xml文件將乾淨目標設置爲構建的一部分。

0

如果您自動設置構建,那麼在大型項目大小的情況下,eclipse會變慢。它會定期清理並每隔幾秒建立一個項目。建議在大型項目中手動清理工作區。

相關問題