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.
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
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