跳转到内容

错误处理

如果广告加载或展示失败,您的广告展示委托或回传接口会收到调用。 该调用带有一个错误代码。 本页介绍了这些错误代码。

错误对象

您在回传中收到的错误是一个实现 MaxError 的一等 (first-class) 错误对象。 该对象具有以下方法:

getCode()
返回错误代码,见下表。
getMessage()
返回描述该错误的可读信息。
getMediatedNetworkErrorCode()
返回聚合平台针对该错误的错误代码。 仅适用于广告展示失败回传中返回的错误。
getMediatedNetworkErrorMessage()
返回聚合平台针对该错误的错误信息。 默认为空字符串。 仅适用于广告展示失败回传中返回的错误。
getWaterfall()
Allows you to see information about the current waterfall for an ad. Network responses provide the ad load state, latency, credentials, and mediated network information for each ad in the waterfall. If an ad in the waterfall fails to load, the network response provides error information. You can learn more about this method in Advanced Settings: Waterfall Information API.

MAX 错误代码

代码常量描述加载 / 展示
204MaxErrorCode.NO_FILLNo ads are eligible for your device (no fill). MAX returned no eligible ads from any mediated networks for this app/device.L
-1MaxErrorCode.UNSPECIFIEDThe system is in an unexpected state. MAX could not categorize this state into one of the other defined errors. See the message field in the error object for more details.L/D
-23MaxErrorCode.FULLSCREEN_AD_ALREADY_SHOWING您尝试展示一则全屏广告 (插屏广告或激励广告),但另一则全屏广告仍在展示。D
-24MaxErrorCode.FULLSCREEN_AD_NOT_READY您试图在广告加载完成之前显示全屏广告。D
-1000MaxErrorCode.NETWORK_ERROR由于一般网络错误,广告请求失败。请查看错误对象中的消息字段,了解更多详情。L
-1001MaxErrorCode.NETWORK_TIMEOUT由于网速较慢,广告请求超时。L
-1009MaxErrorCode.NO_NETWORK设备未连接至互联网,广告请求失败。L
-5001MaxErrorCode.AD_LOAD_FAILED无平台可填充广告,因此加载失败。MAX 已返回来自被聚合平台的符合条件的广告,但所有广告均加载失败。请查看 MaxError.getWaterfall() 了解更多详情。L
-5201MaxErrorCode.ERROR_CODE_INVALID_LOAD_STATEThe internal state of the SDK is invalid.L
-5205MaxAdapterError.AD_NOT_READY适配器在尝试展示时没有已准备好的广告。L
-5209MaxAdapterError.INTERNAL_ERROR未指明的内部错误。L
-5601MaxErrorCode.NO_ACTIVITYSDK 无法加载广告,因为找不到最顶层的 ActivityL
-5602MaxErrorCode.DONT_KEEP_ACTIVITIES_ENABLEDSDK 未能展示广告,因为用户启用了 “Don’t Keep Activities” 开发者设置。D
-5603MaxErrorCode.INVALID_AD_UNIT_IDThe SDK failed to load an ad because the publisher provided an invalid ad unit identifier. Possible reasons:
  • ad unit identifier is malformed or does not exist
  • ad unit is disabled
  • ad unit is not associated with the current app’s package name
  • ad unit was created in the last 30–60 minutes
L

不同平台的错误代码

To better understand the error codes that ad networks return, see the error documentation pages published by those networks: