Reputation: 229
W/Ads: There was a problem getting an ad response. ErrorCode: 1
W/Ads: Failed to load ad: 1
From logcat,
This is my code in Activity:
MobileAds.initialize(getApplicationContext(), "ca-app-pub-6122511777440087~4654564876");
AdView mAdView = (AdView) findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().build();
mAdView.loadAd(adRequest);
And layout:
<com.google.android.gms.ads.AdView
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
ads:adSize="BANNER"
ads:adUnitId="@string/banner_ad_unit_id">
</com.google.android.gms.ads.AdView>
Lastly my string resource:
<string name="banner_ad_unit_id">ca-app-pub-6122511777440087~4654564876</string>
What gives? I even tried a test ad and that didn't work. Same error code and same failure to load ad.
Upvotes: 4
Views: 7525
Reputation: 735
app id and app unit id should be different. in your code seems to be same
here is full official description: https://firebase.google.com/docs/admob/android/quick-start
Upvotes: 8