Issues with Admob Ads in Android App

I have issues with embedding ads with xml. I try to do this with xml but it tells me error: Error parsing XML: unbound pref on com.google.ads.AdView :

It doesn't show after doing this but I see the incoming ad on my logCat.

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
 xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/activity_tuto_layout">



<RelativeLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:layout_centerHorizontal="true"
    android:background="@drawable/card_shadow_base"
    android:layout_marginTop="@dimen/default_vertical_margin"
    android:layout_marginLeft="@dimen/default_horizontal_margin"
    android:layout_marginRight="@dimen/default_horizontal_margin"
    android:paddingBottom="2dp"
    android:id="@+id/tuto_title_card">

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/imageView"
        android:src="@drawable/ic_launcher"
        android:layout_alignParentRight="true"
        android:layout_alignParentBottom="false"
        android:layout_alignParentTop="true" />

    <TextSwitcher
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/tuto_text_switcher"
        android:layout_centerVertical="true"
        android:layout_alignParentLeft="true"
        android:layout_toLeftOf="@+id/imageView">

    </TextSwitcher>


</RelativeLayout>

<android.support.v4.view.ViewPager
    android:id="@+id/pager"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_below="@+id/tuto_title_card"
    android:layout_above="@+id/closeButton" />
<LinearLayout        
    android:layout_width="fill_parent"
    android:layout_height="wrap_content" 
    android:layout_above="@id/closeButton"
    android:layout_below="@+id/pager">

<com.google.ads.AdView
    android:id="@+id/adView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    ads:adSize="BANNER"
     ads:adUnitId="xxxxxxxxxxxxx" />
</LinearLayout>

<Button
    android:id="@+id/closeButton"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_centerHorizontal="true"
    android:background="@drawable/button_close"
    android:paddingBottom="12dp"
    android:paddingTop="12dp"
    android:text="@string/tuto_button_close"
    android:textColor="@color/white"
    android:textSize="@dimen/home_text_size" />

And in my java file :

    AdView adView = (AdView)findViewById(R.id.adView);
    AdRequest aRequest = new AdRequest();
    aRequest.setTesting(true);
            aRequest.addTestDevice("C0150396075730E422F8D1C212A5B658");
    adView.loadAd(aRequest); 

What am I doing wrong here?

Answers


You need to add the namespace xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads" in your first RelativeLayout

Change the first RelativeLayout

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/activity_tuto_layout">

with:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/activity_tuto_layout">

Need Your Help

Protocol Buffer Wireshark Plugin

tcp protocol-buffers wireshark wireshark-dissector

I am looking for a wireshark plugin for google protocol buffer. And I found this GPB Wireshark plugin http://code.google.com/p/protobuf-wireshark/

Calculate the area a camera can see on a plane

language-agnostic geometry

I have a camera with the coordinates x,y at height h that is looking onto the x-y-plane at a specific angle, with a specific field of view. I want to calculate the 4 corners the camera can see on the