-1

So earlier it said i had junk xml now after playing around and trying different solutions i have 2 errors instead of 1! Now i have an error next to ?xml version="1.0" encoding="utf-8"?> that says:error parsing prefix: unbound XML

and the other error next to com.admob.android.ads.AdView says:The markup in the document following the root element must be well-formed.

     <?xml version="1.0" encoding="utf-8"?<
<WebView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/webview"
android:layout_width="fill_parent"
android:layout_height="fill_parent" 

/>

<com.admob.android.ads.AdView
  android:id="@+id/ad" 
  android:layout_width="fill_parent" 
  android:layout_height="wrap_content"
  xmlns:backgroundColor="#000000"
  xmlns:primaryTextColor="FFFFFF"
  xmlns:secondaryTextColor="#CCCCCC"
  android:layout_alignParentTop="true"
  ads:adUnitId="xxxxxxxxxxxx"
  ads:adSize="BANNER"
  ads:loadAdOnCreate="true"
  /> 
badmanthe5
  • 71
  • 1
  • 2
  • 9

2 Answers2

1

<?xml must be the first characters in an XML file.

Remove your leading whitespace.

SLaks
  • 868,454
  • 176
  • 1,908
  • 1,964
0

You need a container. Right click on your WebView in Eclipses "Outline" window and choose "Wrap in container"

If you're not using Eclipse, just put the Webview and the AdView within a Layout widget

Example:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/layoutContainer"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <WebView
        android:id="@+id/webview"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" />

    <com.admob.android.ads.AdView xmlns:backgroundColor="#000000"
        xmlns:primaryTextColor="FFFFFF"
        xmlns:secondaryTextColor="#CCCCCC"
        android:id="@+id/ad"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        ads:adSize="BANNER"
        ads:adUnitId="xxxxxxxxxxxx"
        ads:loadAdOnCreate="true" />

</LinearLayout>
mrres1
  • 1,147
  • 6
  • 10
  • this is embarrassing but how do i do that? I assume the outline container is either the pane on the left(unless that is the package explorer) or the main center area where i can see the XML. – badmanthe5 Sep 30 '12 at 02:19
  • In Eclipse's menu bar, go to Window > Show Views. If it's not in the list then choose Other and type in Outline – mrres1 Sep 30 '12 at 02:21
  • Oh i see i completely skipped the layout, Duh! But im still getting an error parsing XML:unbound prefix next to – badmanthe5 Sep 30 '12 at 02:24
  • Is the AdMob library imported to the project? – mrres1 Sep 30 '12 at 02:44
  • if you mean the java file yes. I copied the AdMobSDK in to the libs folder and then added it. – badmanthe5 Sep 30 '12 at 02:50
  • it says unbound prefix so something must be wrong here: sorry for the crappy layout – badmanthe5 Sep 30 '12 at 02:52