Errors and troubleshooting
Where errors appear
| Source | How it fails |
|---|---|
Admob.initialize() | Rejects, for example when the app ID is missing. |
XxxAd.load() | Rejects with the message "<code>: <message>" from the SDK, or the initialization error. |
ad.show() | Throws synchronously when the ad was already shown or has expired. |
ad.onAdFailedToShow | Called with an AdmobError when presenting fails. |
<BannerAd onAdFailedToLoad> | Called with an AdmobError for each failed request. |
AdPreloader onLoadError | Called with each rejection of its load function, before the retry. |
AdmobError.code
| Platform | code |
|---|---|
| iOS | The numeric GADErrorCode, as a string. |
| Android | The SDK ErrorCode name. |
| Both | initialization-failed when the SDK could not start (banners). |
Because the codes differ per platform, branch on code per platform or log it rather than matching a single value.
Handling load failures
try {
const ad = await InterstitialAd.load(adUnitId)
ad.show()
} catch (error) {
console.warn(error instanceof Error ? error.message : String(error))
}
No fill is normal, especially for new ad units. Prefer AdPreloader, which retries with backoff (5 seconds doubling up to 5 minutes), over retrying in a loop.
Troubleshooting
| Symptom | Check |
|---|---|
initialize() rejects with "Add GADApplicationIdentifier…" | The iOS app ID in Info.plist; see native setup. |
initialize() rejects with "Add <meta-data …" | The Android app ID in AndroidManifest.xml, inside <application>. |
show() throws "This ad was already shown." | Each ad shows once. Load a new one or use AdPreloader. |
show() throws "This ad expired." | The ad passed expiresAt (1 hour, app open 4 hours). Load a new one. |
| An adaptive banner never loads | It needs a laid-out width greater than 0. Stretch it or give it a width. |
| No app open ad after returning to the app | None is ready yet, another full-screen ad is showing, minimumInterval has not passed, or it was a cold start. |
nitro-ui prepare complains about nitro-core | Add the overrides from installation. |
| Real ads on your own device during development | Use Admob.testAdUnitId or add the device to testDeviceIds. |