Solution 1 :
Make sure you use the correct test ad ID from AdMob in the call InterstitialAd. This is not the same as your App ID, it has an attached slash and a number behind it.
For testing,
use ca-app-pub-3940256099942544/1033173712 which is the test ID given by the docs at the time of writing.
Solution 2 :
I’ve noticed that this error occurs in these cases:
- When you type wrong adUnitId.
- When you pass wrong AdSize (ex. too big or too small).
- When Google stops displaying ads in your app, because you break some admob rules.
Solution 3 :
I had a similar problem, after checking I found out that I entered the unit ID incorrectly.
Solution 4 :
For instersticial Ad the Sample ad unit ID must be: ca-app-pub-3940256099942544/1033173712
Here is the demo ad units that point to specific test creatives for each format.
Solution 5 :
Never use App id from the console to Test ads in your app. Instead use these sample id’s:
Ad format | Sample Ad Unit Id | How it looks |
---|---|---|
App Open | ca-app-pub-3940256099942544/3419835294 | ![]() |
Banner | ca-app-pub-3940256099942544/6300978111 | ![]() |
Interstitial | ca-app-pub-3940256099942544/1033173712 | No preview |
Interstitial Video | ca-app-pub-3940256099942544/8691691433 | ![]() |
And a lot more. You can find all of them here
Problem :
I have implemented admob interstitial ad recently and getting exception/error as Error building request URL. from method onAdFailedToLoad(), and also my ad is not shown
.
My code:
InterstitialAd interstitialAd;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
InterstitialAd interstitialAd = new InterstitialAd(MainActivity.this);
interstitialAd.setAdUnitId(KEY);
MobileAds.initialize(MainActivity.this, new OnInitializationCompleteListener() {
@Override
public void onInitializationComplete(InitializationStatus initializationStatus) {
Log.e("app","MobileAds onInitializationComplete");
}
});
interstitialAd.loadAd(new AdRequest.Builder().build());
interstitialAd.setAdListener(new AdListener(){
@Override
public void onAdLoaded() {
Log.e("app","ad loaded");
}
@Override
public void onAdFailedToLoad(LoadAdError loadAdError) {
Log.e("app","ad failedToLoad: "+loadAdError.getMessage()); //error/exception here
}
});
}
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if(interstitialAd.isLoaded()) {
interstitialAd.show();
Log.e("app","ad loaded");
}
else Log.e("app","ad not loaded yet");
}
}
I have registered my id properly in the Manifest.xml
<application>
<meta-data
android_name="com.google.android.gms.ads.APPLICATION_ID"
android_value="@string/KEY"/>
</application>
Followed same guideline shown in here
Comments
Comment posted by Abhay Koradiya
use testing id for test.
Comment posted by Bugzilla
If you load => fail => try load again => fail => try load again you may hit the API rate limit that triggers the 3 – Error building request url. I think the limit is 3 request every 10 seconds.
Comment posted by Wouter Vandenputte
I have been having this problem for hours and it indeed seemed that I was having an issue with my adsize. Thanks!!!
Comment posted by Sambhav Khandelwal
It would be better if you add the link to docs and also write this in the form of text