Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why show error unexpected namespace prefix xmlns in android?

Tags:

android

xml

I want to display Google ads in my app but it shows error unexpected namespace prefix xmlns at this tag xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads". If I remove this line then it shows Error parsing XML:unbound prefix. Please help me to identify that where things go wrong. Here is my code.

<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/LinearLayout1"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:background="@drawable/background_port"
    tools:context=".MainActivity">

    <LinearLayout xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
              android:orientation="vertical"
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              android:gravity="center"
              >

    <com.google.ads.AdView android:id="@+id/adView"
                         android:layout_width="wrap_content"
                         android:layout_height="wrap_content"
                         ads:adUnitId="a151b801b7c1d6b"
                         ads:adSize="BANNER"
                         ads:testDevices="TEST_EMULATOR, TEST_DEVICE_ID"
                         ads:loadAdOnCreate="true"/>
    </LinearLayout>

    --------------------
    ---- More views ----
    --------------------

 </LinearLayout>
like image 658
user2391890 Avatar asked Jul 22 '13 20:07

user2391890


People also ask

How do I remove namespace prefix?

Once a namespace prefix is created, it cannot be changed or deleted. The workaround is to move all your code to a new Developer Organization, where you can setup the desired Namespace Prefix.

Why we need XmlNs in XML?

One of the primary motivations for defining an XML namespace is to avoid naming conflicts when using and re-using multiple vocabularies. XML Schema is used to create a vocabulary for an XML instance, and uses namespaces heavily.

What is XmlNs file?

It means XML namespace. Basically, every element (or attribute) in XML belongs to a namespace, a way of "qualifying" the name of the element.

What is XmlNs in Java?

Annotation Type XmlNs @Retention(value=RUNTIME) @Target(value={}) public @interface XmlNs. Associates a namespace prefix with a XML namespace URI. Usage. @XmlNs annotation is intended for use from other program annotations. See "Package Specification" in javax.


1 Answers

The error removed by CLEANING THE PROJECT

Project menu -> Clean -> Select Proj -> OK

like image 115
user2391890 Avatar answered Oct 05 '22 08:10

user2391890