每次编辑XML文件都必须在Eclipse中清理整个Android项目

5

我遇到了一个非常烦人的问题。我在我的Android项目中使用了一个Fragment,但每次编辑主xml文件后都需要清理项目,这让我感到十分苦恼。下面是它的样子:

<?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>

如果我修改了这个文件的任何一个字符,所有以"map"开头的行都会被突出显示为红色,并且片段的开头标签也会被突出显示。我收到的错误提示是:

Unexpected namespace prefix "xmlns" found for tag fragment

对于以“map”开头的行,错误是:

Unexpected namespace prefix "map" found for tag fragment

如果我清理项目,问题就会消失,我可以正常构建和运行项目,但现在我正在频繁编辑它,这非常非常令人讨厌。请问有人能帮忙吗?
2个回答

5
在Eclipse中,你可以进入“项目”-“构建自动化”选项,这将包括一个清理过程。你也可以使用adb来构建一个ANT脚本,并使用build.xml文件设置清理目标作为构建的一部分。

0

如果你设置了自动构建,那么在大型项目的情况下,Eclipse 会变得很慢。它会定期清理并重新构建整个项目。建议在大型项目中手动清理工作区。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接