في الحالات التي يتعذّر فيها تحميل الإعلان، يتم استدعاء دالة ردّ اتصال توفّر عنصر LoadAdError
.
بالنسبة إلى AdManagerAdView
، يتم استدعاء ما يلي:
Kotlin
fun onAdFailedToLoad(error: LoadAdError)
Java
public void onAdFailedToLoad(LoadAdError adError);
يعرض المثال التالي المعلومات المتاحة عند تعذُّر تحميل إعلان:
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/ad-manager/mobile-ads-sdk/android/reference/com/google/android/gms/ads/AdRequest#constant-summary
// for a list of possible codes.
val errorCode = error.code
// Gets an error message.
val errorMessage = error.message
// Gets additional response information about the request. See
// https://developers.google.com/ad-manager/mobile-ads-sdk/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(LoadAdError error) {
// Gets the domain from which the error came.
String errorDomain = error.getDomain();
// Gets the error code. See
// https://developers.google.com/ad-manager/mobile-ads-sdk/android/reference/com/google/android/gms/ads/AdRequest#constant-summary
// for a list of possible codes.
int errorCode = error.getCode();
// Gets an error message.
String errorMessage = error.getMessage();
// Gets additional response information about the request. See
// https://developers.google.com/ad-manager/mobile-ads-sdk/android/response-info
// for more information.
ResponseInfo responseInfo = error.getResponseInfo();
// Gets the cause of the error, if available.
AdError cause = error.getCause();
// All of this information is available using the error's toString() method.
Log.d("Ads", error.toString());
}
تصحيح أخطاء رسائل تسجيل الأخطاء الشائعة
في الإصدار 23.5.0 من "SDK لإعلانات Google على الأجهزة الجوّالة"، تم تحسين التسجيل المفصّل ليشمل تتبُّع تسلسل استدعاء الدوال البرمجية لمكان تعذُّر تحميل الإعلان. لا تشير هذه الرسائل إلى حدوث عطل، بل تحدّد المصدر الفريد للخطأ. يعرض الجدول التالي سجلّات الأخطاء الشائعة والأوصاف والإجراءات المقترَحة لحلّها:
سجلّ الأخطاء | الوصف | الإجراءات المقترَحة |
---|---|---|
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 غير مسموح به في العمليات ذات الامتيازات. |
|
لم ينجح طلب الإعلان بسبب بطء الاتصال بالشبكة. | حاوِل تحسين اتصالك بالإنترنت وأعِد المحاولة. | |
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. |
يتعذّر على "حزمة SDK لإعلانات Google على الأجهزة الجوّالة" العثور على محوّل التوسّط. |
|
com.google.android.gms.internal.ads.*: Received error HTTP response code: 403 |
رفضت خوادم "مدير إعلانات Google" الطلب. | يُرجى إعادة المحاولة لاحقًا. إذا كان الخطأ قابلاً للتكرار باستمرار، سجِّل عنوان URL للطلب باستخدام أداة فحص الإعلانات وتواصَل مع فريق الدعم. |