Android xml error Attribute is missing the Android namespace prefix [Solution]


Attribute is missing the Android namespace prefix

This error is related to one of the XML files in your Android Workspace Project,

Reason ?

You have missed out xmlns namespace attribute in one of your XML: AndroidManifest.xml, layout.xml, or any Custom XML that you have added.

Solution :

Check that these XML files contains, xmlns:android="http://schemas.android.com/apk/res/android"

If the Android namespace is not present Eclipse will throw an error.

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.demo"
    android:versionCode="1"
    android:versionName="1.0" >
    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="21" />
    
    <uses-feature android:name="android.hardware.camera" />
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.hardware.camera.autofocus" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    
    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
</manifest>