AdMob won't show in my app. Every time I invoke loadAd(..)
I get the following errors:
Requesting resource 0x7f0b000e failed because it is complex. The Google Play services resources were not found. Check your project configuration to ensure that the resources are included. There was a problem getting an ad response. ErrorCode: 1
I searched hours for a solution to this problem but haven't found anything that works for me! I downloaded the latest version of the Google Play Services
and added them as library in my project preferences
Here is my code: Activity:
public class WelcomeActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.setContentView(R.layout.activity_welcome);
// Look up the AdView as a resource and load a request.
AdView adView = (AdView) this.findViewById(R.id.welcomeAdView);
AdRequest.Builder adRequestBuilder = new AdRequest.Builder();
adRequestBuilder.addTestDevice("************");
adRequestBuilder.addTestDevice(AdRequest.DEVICE_ID_EMULATOR);
AdRequest adRequest = adRequestBuilder.build();
adView.loadAd(adRequest);
}
}
Layout xml:
<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"
xmlns:app="http://schemas.android.com/apk/res/xx.xx"
android:id="@+id/container"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
tools:context="xx.xx.WelcomeActivity" >
.... other layout stuff .....
<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>
</RelativeLayout>
AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="xx.xx"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="19" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:allowBackup="true"
android:icon="@drawable/icon"
android:label="@string/app_name"
android:theme="@android:style/Theme.Holo.Light" >
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<activity
android:name="xx.xx.WelcomeActivity"
android:label="@string/app_name"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
... some more activities ...
<activity
android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" >
</activity>
</application>
</manifest>
MOBILE ADS TROUBLESHOOTINGEnsure you don't have too many apps running in the background. Check to see if there are any privacy settings/settings on your device that restrict you from viewing ads. Check that your Internet provider/region does not restrict ads, or your modem/provider doesn't throttle ads or ad content.
Test devices You can configure your device as a test device and use your own ad unit IDs that you've created in your AdMob account. When you enable a test device, the AdMob Network sends production ads in test mode to your device using the ad unit IDs you've created in your AdMob account.
Sign in to your AdMob account at https://apps.admob.com. Click Policy center in the sidebar. Click Fix next to the app you'd like to be reviewed. In the Issues found section, review the required steps, then click Request Review.
Ads won't show if you haven't integrated the Google Mobile Ads SDK correctly. Is your ad implementation code working properly? Test your implementation code to check that ads can show. You can also use ad inspector to test your app's ad serving.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With