gambiting
gambiting

Reputation: 365

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

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?

Upvotes: 5

Views: 857

Answers (2)

adnan_it
adnan_it

Reputation: 88

if you set up build automatically then eclipse would be slow down in large project size case. it clean and build your whole project after every few seconds periodically. it is recommended in large project case to manually clean your workspace.

Upvotes: 0

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.

Upvotes: 5

Related Questions