AdMob won\'t show in my app. Every time I invoke loadAd(..)
I get the following errors:
Requesting resource 0x7f0b000e failed because it
In your layout file (activity_welcome.xml), the adview container (RelativeLayout) layout width/height looks strange to me. And I think it is useless in your use case.
Change from:
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentBottom="true" >
<com.google.android.gms.ads.AdView
android:id="@+id/welcomeAdView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
ads:adSize="BANNER"
ads:adUnitId="pub-***************" />
</RelativeLayout>
to:
<com.google.android.gms.ads.AdView
android:id="@+id/welcomeAdView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
ads:adSize="BANNER"
ads:adUnitId="pub-***************" />
Add this inside application tag in your Manifest file:
<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version"/>
I don't find any issue with your code/layout. Issue could be with the Ads Unit Id
.
I would suggest you to try creating a different Ads Unit Id
Hope it works.
You used wrong ads:adUnitId="pub-***************"
. It must looks like ca-app-pub-3940256099942544/6300978111
format. You can take it after creating banner by url https://apps.admob.com/#monetize/adunit:create
Just adding this in case someone else has the same problem as mine.
I tried using a new Ads Unit ID
and that didn't work as well. In the end, the issue was because I was trying to fix an app that got suspended from Google Play and Admob had also actually stopped serving ads to applications with the specific package name / bundle ID
.
Changing the package name
of the application solved the issue for me.
Also Your package might be blocked by Google AdMob. If you received a email like this:
Hello,
This email is to alert you that one of your applications is not currently in compliance with our AdMob program policies and as a result, ad serving has been disabled to your application.
Ad serving has been disabled to: APPNAME (com.example.pack)
Action required: Check all other remaining applications in your account for compliance.
Current account status: Active .....
So now you need to change your package of your app. on eclipse it is package="com.example"