Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Have to clean entire Android project in Eclipse every time an XML file is edited

Tags:

android

xml

I am having an annoying problem. I am using a Fragment in my Android project, and it's causing me endless pain, as I have to clean the project every single time I edit my main xml file. This is how it looks:

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

And if I edit even one character of this file, all lines beginning with "map" get highlighted with red, and the fragment opening tag gets highlighted as well. The error I am getting is:

Unexpected namespace prefix "xmlns" found for tag fragment

And for the lines beginning with "map" the error is:

Unexpected namespace prefix "map" found for tag fragment

If I clean the project the problem goes away and I can build and run the project just fine, but as I am editing it a lot right now it is very very annoying. Could somebody help please?

like image 452
gambiting Avatar asked Apr 04 '13 11:04

gambiting


1 Answers

In Eclipse you can go to Project -> build automatically which should include a clean process. You could also use adb to build an ANT script and use the build.xml file to set a clean target as part of the build.

like image 93
Brian Melton-Grace - MSFT Avatar answered Sep 29 '22 08:09

Brian Melton-Grace - MSFT