AI-generated Key Takeaways
-
When an ad fails to load, a callback is triggered providing a
LoadAdErrorobject containing information about the error. -
The
LoadAdErrorobject provides details such as the error domain, code, message, response information, and cause. -
For errors originating from
MobileAds.ERROR_DOMAIN, further details and potential solutions can be found in the "Resolve common onboarding issues" article. -
Version 23.5.0 of the Google Mobile Ads SDK includes enhanced verbose logging with stack traces to identify the source of ad loading errors.
-
A table provides common error logs, descriptions, and suggested actions for resolution, covering various network and configuration issues.
In cases where an ad fails to load, a
callback
is called which provides a LoadAdError
object.
For AdView
, the following is called:
Kotlin
fun
onAdFailedToLoad
(
error
:
LoadAdError
)
Java
public
void
onAdFailedToLoad
(
LoadAdError
adError
)
;
The following example shows the information available when an ad fails to load:
Kotlin
override
fun
onAdFailedToLoad
(
error
:
LoadAdError
)
{
// Gets the domain from which the error came.
val
errorDomain
=
error
.
domain
// Gets the error code. See
// https://developers.google.com/admob/android/reference/com/google/android/gms/ads/AdRequest#constant-summary
// for a list of possible codes.
val
errorCode
=
error
.
code
// Gets an error message.
// For example "Account not approved yet". See
// https://support.google.com/admob/answer/9905175 for explanations of
// common errors.
val
errorMessage
=
error
.
message
// Gets additional response information about the request. See
// https://developers.google.com/admob/android/response-info
// information.
val
responseInfo
=
error
.
responseInfo
// Gets the cause of the error, if available.
val
cause
=
error
.
cause
// All of this information is available using the error's toString() method.
Log
.
d
(
"Ads"
,
error
.
toString
())
}
Java
@Override
public
void
onAdFailedToLoad
(
@NonNull
LoadAdError
adError
)
{
// Gets the domain from which the error came.
String
errorDomain
=
adError
.
getDomain
();
// Gets the error code. See
// https://developers.google.com/admob/android/reference/com/google/android/gms/ads/AdRequest#constant-summary
// for a list of possible codes.
int
errorCode
=
adError
.
getCode
();
// Gets an error message.
// For example "Account not approved yet". See
// https://support.google.com/admob/answer/9905175 for explanations of
// common errors.
String
errorMessage
=
adError
.
getMessage
();
// Gets additional response information about the request. See
// https://developers.google.com/admob/android/response-info
// information.
ResponseInfo
responseInfo
=
adError
.
getResponseInfo
();
// Gets the cause of the error, if available.
AdError
cause
=
adError
.
getCause
();
// All of this information is available using the error's toString() method.
Log
.
d
(
"Ads"
,
adError
.
toString
());
}
MobileAds.ERROR_DOMAIN
,
the message
can be looked up in the Resolve common onboarding issues article
for a more detailed explanation and possible actions that can be taken to
resolve the issue. Debug common error logging messages
In version 23.5.0 of Google Mobile Ads SDK, verbose logging was enhanced to include a stack trace of where the ad fails to load. These message don't indicate a crash, but rather identify the unique source of the error. The following table provides common error logs, descriptions, and suggested actions for resolution:
com.google.android.gms.ads.nonagon.render.cp: *
com.google.android.gms.ads.nonagon.render.e: *
com.google.android.gms.ads.internal.util.*: Unable to obtain a JavascriptEngine.
WebView
is not
allowed in privileged processes.- Check your internet settings.
- Remove
android:sharedUserId="android.uid.system"and install app as system app.
com.google.android.gms.ads.nonagon.load.a
com.google.android.gms.ads.internal.util.*: Error while
connecting to ad server: Unable to resolve host "pubads.g.doubleclick.net":
No address associated with hostname
com.google.android.gms.ads.internal.util.*: Error building
request URL: Cannot determine request type. Is your ad unit id correct?
com.google.android.gms.ads.internal.render.bt: Unable to
instantiate mediation adapter class.
- Diagnose which adapters Google Mobile Ads SDK can't find using View available adapters in ad inspector.
- Add missing adapters to your project. To read instructions for how to complete this step for each ad source, see Network details .
com.google.android.gms.internal.ads.*: Received error HTTP response code: 403

