Skip to content Skip to sidebar Skip to footer

Admob Ads Doesn't Show Up

I made a simple app and added inside it an ad but it doesn't show up in the device. and there is no errors in my code: xml page: Copy

Solution 2:

I think the problem is here

 <com.google.android.gms.ads.AdView
    xmlns:app="http://schemas.android.com/apk/libs/com.google.ads"
    android:id="@+id/adView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:layout_centerHorizontal="true"
    android:layout_marginTop="66dp"
    ads:adSize="BANNER"
    ads:adUnitId="ad_ip" >

1) The xmlns attribute should be like this and in my case I have placed in the root tag of xml file.

        xmlns:ads="http://schemas.android.com/apk/res-auto"

2) Check, you have given the actual adUnitId from admob account.

Hope this will help you, if any further problems, you can ask.

Solution 3:

You are importing the wrong xmlns attribute inside your adview (it refers to legacy admob):

<com.google.android.gms.ads.AdView
xmlns:app="http://schemas.android.com/apk/libs/com.google.ads"

you should only use the following which refers to Google Play Admob:

xmlns:ads="http://schemas.android.com/apk/res-auto"

==> remove the wrong xmlns attribute

Solution 4:

Try this

XML:

       <com.google.ads.AdView
        android:id="@+id/ad"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="66dp"
        ads:adSize="BANNER"
        ads:adUnitId="your key ID"
        ads:loadAdOnCreate="true"/>

Add following code in your manifest:

<activityandroid:name="com.google.ads.AdActivity"android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />

Hope this will help you..

Post a Comment for "Admob Ads Doesn't Show Up"