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:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/RelativeLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
>
<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" >
</com.google.android.gms.ads.AdView>
</RelativeLayout>
manifest file:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="com.google.android.gms.permission.ACTIVITY_RECOGNITION" ></uses-permission>
<meta-data
android:name="com.google.android.gms.version"
android:value="4.3.23" />
<activity android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
I think the problem is here
1) The xmlns attribute should be like this and in my case I have placed in the root tag of xml file.
2) Check, you have given the actual adUnitId from admob account.
Hope this will help you, if any further problems, you can ask.
You are importing the wrong
xmlns
attribute inside your adview (it refers to legacy admob):you should only use the following which refers to Google Play Admob:
==> remove the wrong
xmlns
attributeAt the beginning I had made the same mistake, I only used the xml file and didn´t load the view in my Activity. So just put this inisde the activity:
Try this
XML:
Add following code in your manifest:
Hope this will help you..