微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

我有一个恼人的问题.我在我的 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

如果我清理项目问题就会消失,我可以很好地构建和运行项目,但是由于我现在正在编辑它很多,所以它非常烦人.有人可以帮忙吗?

解决方法

在Eclipse中,您可以转到Project – >自动构建,应该包括一个干净的过程.您还可以使用adb构建ANT脚本,并使用build.xml文件将清理目标设置为构建的一部分.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。