Android Error Codes
Overview
This document lists the error codes that may be returned by the UjuAd Android SDK and their meanings, helping developers quickly troubleshoot and resolve issues.
In the onLoadError and onAdError callbacks, developers receive a UjuException object and obtain error info via error.code and error.message. This document lists all possible error codes.
SDK Core Error Codes
The following error codes are defined in the ErrorType enum and are the core error codes exposed by the SDK:
| Code | Enum Name | Meaning | Possible Cause | Solution |
|---|---|---|---|---|
| 0 | SUCCESS | Success | Operation successful | - |
| 1000 | UNKNOWN | Unknown error | Error caused by unknown reason | Contact technical support and provide logs |
| 1001 | INIT_ERROR | Init failed | Wrong appId/appKey, network issue, config exception | Check if appId and appKey are correct, check network connection |
| 1002 | CONFIG_ERROR | Config parameter error | UjuAdConfig or UjuAdInitConfig parameter missing or format error | Check if config parameters are complete and correct |
| 1003 | BIDDING_ERROR | Bidding error | Ad bidding flow exception | Check ad placement config, confirm bidding strategy is correct |
| 1004 | PERMISSION_DENIED | Missing required permission | AndroidManifest.xml missing required permission declarations | Add INTERNET, ACCESS_NETWORK_STATE, and other permissions |
| 1005 | PARAM_ERROR | Invalid parameter | Input validation failed, e.g., placementId is empty | Check if input parameters are valid |
| 1030 | NETWORK_ERROR | Network connection exception | No network connection or network timeout | Check network connection, retry later |
| 2001 | LOAD_ERROR | Ad load failed | No ad fill, adapter exception, ad placement config error | Check placement ID, confirm adapter is imported, retry later |
| 2009 | SHOW_ERROR | Ad display failed | Called show before ad loaded successfully, wrong state | Ensure show is called after onLoadSuccess, check isReady() |
| 2010 | TIMEOUT | Operation timeout | Ad request or load timeout | Check network condition, appropriately increase timeout or retry |
| 2011 | NOT_FIND_ADAPTER | Adapter not found | Adapter for the corresponding ad network not imported | Check if build.gradle imports the corresponding ADN adapter dependency |
ADX Self-Owned Ad Source Error Code Segments
The SDK internal ADX self-owned ad sources use independent error code segments, defined in AdxErrorEnums:
| Code Segment | Category | Description |
|---|---|---|
| 0 | Success | ADX request successful |
| 1xxx | Data related | Data parsing, data format, and other errors |
| 2xxx | Video related | Video creative loading, playback, and other errors |
| 3xxx | Image related | Image creative loading, rendering, and other errors |
| 4xxx | Network related | ADX network request, connection, and other errors |
| 5xxx | Reporting related | Event reporting, tracking, and other errors |
| 6xxx | Deeplink related | Deep link jump errors |
| 9xxx | General errors | Other uncategorized errors |
Error Handling Best Practices
1. Distinguish onLoadError and onAdError
onLoadError(error: UjuException, placementId: String): Ad load phase failure, common error codes 1001/1002/1003/1030/2001/2011onAdError(error: UjuException): Ad display phase failure, common error codes 2009/2010
2. Error Log Recording
override fun onLoadError(error: UjuException, placementId: String) {
// Record error code, error message, and placement ID for troubleshooting
Log.e("UjuAd", "Load failed: code=${error.code}, msg=${error.message}, pid=$placementId")
}
override fun onAdError(error: UjuException) {
// Record display phase errors
Log.e("UjuAd", "Show failed: code=${error.code}, msg=${error.message}")
}3. Retry Mechanism
- For network errors (1030) and timeouts (2010), implement a reasonable retry mechanism
- Set retry interval and max retry count to avoid infinite retries
- Recommended retry interval 3-5 seconds, max 3 retries
4. Common Issue Troubleshooting
| Symptom | Possible Error Code | Troubleshooting Direction |
|---|---|---|
| SDK init failed | 1001 | Check if appId/appKey/channel are correct |
| Ad not loading | 2001/2011 | Check placement ID, whether adapter dependency is imported |
| Ad not displaying | 2009 | Confirm show is called after onLoadSuccess, check isReady() |
| No fill | 2001 | Normal phenomenon, insufficient ad inventory, retry later |
| Network error | 1030 | Check network connection |
| Permission error | 1004 | Check AndroidManifest.xml permission declarations |
Contact Technical Support
If you encounter unsolvable error issues, you can contact technical support via:
- Email: marco@ujuad.com
- Ticket: Submit a ticket in the UjuAd developer backend
- Online Support: Contact online support via the official website
Providing the error code, error message, environment, and reproduction steps helps technical support locate and resolve issues faster.
