question

AlexS avatar image
AlexS asked

Android app - no Amazon ads loading, and AdListener callbacks not called

I am trying to implement Amazon Ads in my Android app, but have not been able to get any ads to display. The message in my logs is always: D/AmazonMobileAds DefaultAdListener: Default ad listener called - Ad Failed to Load. Error code: NO_FILL, Error Message: Server Message: no results I have set up my account, verified my tax information, I have an application key. I have tried both with testing enable and disabled with the same results. I have followed the guide for loading ads from both Amazon and Admob for backfill, but the AdMob ads are then not retrieved either. If I retrieve just AdMob ads, I have no problem with them. The relevant code is below: in onCreate(): AdRegistration.setAppKey(getString(R.string.amazon_ad_id)); AdRegistration.enableTesting(true); AdRegistration.enableLogging(true); // Initialize ad views amazonAdView = new com.amazon.device.ads.AdLayout(this); amazonAdView.setListener(new MyAdListener()); admobAdView = new com.google.android.gms.ads.AdView(this); admobAdView.setAdSize(com.google.android.gms.ads.AdSize.SMART_BANNER); admobAdView.setAdUnitId(getString(R.string.banner_ad_unit_id)); Method called to retrieve an ad: void getAd(){ // Initialize view container adViewContainer = (ViewGroup)findViewById(R.id.adView); amazonAdEnabled = true; adViewContainer.removeAllViews(); adViewContainer.addView(amazonAdView); AdTargetingOptions adOptions = new AdTargetingOptions(); adOptions.enableGeoLocation(true); amazonAdView.loadAd(adOptions); } Inner AdListener class class MyAdListener extends DefaultAdListener { public void onAdLoaded(com.amazon.device.ads.AdLayout view, AdProperties adProperties) { Log.d(LOG_TAG, "Ad Loaded"); if (!amazonAdEnabled) { amazonAdEnabled = true; adViewContainer.removeView(admobAdView); adViewContainer.addView(amazonAdView); } } public void onAdFailedToLoad(com.amazon.device.ads.AdLayout view, AdError error) { Log.d(LOG_TAG, "Ad Failed to load"); // Call AdMob SDK for backfill if (amazonAdEnabled) { amazonAdEnabled = false; adViewContainer.removeView(amazonAdView); adViewContainer.addView(admobAdView); } admobAdView.loadAd((new com.google.android.gms.ads.AdRequest.Builder()).build()); } } In my logging, neither of the statements from the AdListener shows, so it appears that the listener is never being called. So, I have two issues here: 1. Why am I always receiving a NO_FILL response, even when testing? 2. Why is the listener never called?
mobile ads
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Andrew@Amazon avatar image
Andrew@Amazon answered
Could you post the logcat from your app? That could help to debug the issue.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

AlexS avatar image
AlexS answered
10-26 14:14:15.521 15495-15495/? I/art: Late-enabling -Xcheck:jni 10-26 14:14:15.620 15495-15495/? I/GAv4: Google Analytics 7.8.95 is starting up. To enable debug logging on a device run: 10-26 14:14:15.620 15495-15495/? I/GAv4: adb shell setprop log.tag.GAv4 DEBUG 10-26 14:14:15.620 15495-15495/? I/GAv4: adb logcat -s GAv4 10-26 14:14:15.725 15495-15495/? D/AmazonMobileAds AdRegistration: Debug logging has been enabled. 10-26 14:14:15.726 15495-15495/? D/AmazonMobileAds AdRegistration: Amazon Mobile Ads API Version: 5.6.20 10-26 14:14:16.148 15495-15495/ D/AmazonMobileAds AdLayout: Initializing AdLayout. 10-26 14:14:16.314 15495-15495/ I/WebViewFactory: Loading com.google.android.webview version 45.0.2454.95 (code 246109500) 10-26 14:14:16.330 15495-15495/ I/cr.library_loader: Time to load native libraries: 1 ms (timestamps 343-344) 10-26 14:14:16.330 15495-15495/ I/cr.library_loader: Expected native library version number "", actual native library version number "" 10-26 14:14:16.408 15495-15495/ V/WebViewChromiumFactoryProvider: Binding Chromium to main looper Looper (main, tid 1) {1fbdf1c5} 10-26 14:14:16.408 15495-15495/ I/cr.library_loader: Expected native library version number "", actual native library version number "" 10-26 14:14:16.409 15495-15495/ I/chromium: [INFO: library_loader_hooks.cc(121)] Chromium logging enabled: level = 0, default verbosity = 0 10-26 14:14:16.424 15495-15495/ I/cr.BrowserStartup: Initializing chromium process, singleProcess=true 10-26 14:14:16.425 15495-15495/ W/art: Attempt to remove local handle scope entry from IRT, ignoring 10-26 14:14:16.430 15495-15495/ E/SysUtils: ApplicationContext is null in ApplicationStatus 10-26 14:14:16.442 15495-15495/ I/Adreno-EGL: : QUALCOMM Build: 01/15/15, ab0075f, Id3510ff6dc 10-26 14:14:16.572 15495-15606/ W/cr.media: Requires BLUETOOTH permission 10-26 14:14:16.581 15495-15495/ E/libEGL: validate_display:255 error 3008 (EGL_BAD_DISPLAY) 10-26 14:14:16.610 15495-15495/ D/AmazonMobileAds MetricsCollector: METRIC Start AD_LAYOUT_INITIALIZATION 10-26 14:14:16.610 15495-15495/ D/AmazonMobileAds MetricsCollector: METRIC Stop AD_LAYOUT_INITIALIZATION 10-26 14:14:16.622 15495-15495/ D/AmazonMobileAds AdLayout: Ad size to be determined automatically. 10-26 14:14:16.622 15495-15495/ E/AmazonMobileAds AdController: An ad is currently loading. Please wait for the ad to finish loading and showing before loading another ad. 10-26 14:14:16.640 15495-15616/ D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true 10-26 14:14:16.648 15495-15495/ D/Atlas: Validating map... 10-26 14:14:16.657 15495-15495/ I/Choreographer: Skipped 44 frames! The application may be doing too much work on its main thread. 10-26 14:14:16.712 15495-15616/ I/OpenGLRenderer: Initialized EGL, version 1.4 10-26 14:14:16.718 15495-15616/ D/OpenGLRenderer: Enabling debug mode 0 10-26 14:14:16.828 15495-15495/ D/AmazonMobileAds AdLayout: Skipping ad layout preparation steps because the layout is already prepared. 10-26 14:14:16.829 15495-15495/ D/AmazonMobileAds MetricsCollector: METRIC Start AD_LATENCY_TOTAL 10-26 14:14:16.829 15495-15495/ D/AmazonMobileAds MetricsCollector: METRIC Start AD_LATENCY_TOTAL_FAILURE 10-26 14:14:16.829 15495-15495/ D/AmazonMobileAds MetricsCollector: METRIC Start AD_LATENCY_TOTAL_SUCCESS 10-26 14:14:16.829 15495-15495/ D/AmazonMobileAds MetricsCollector: METRIC Start AD_LOAD_LATENCY_LOADAD_TO_FETCH_THREAD_REQUEST_START 10-26 14:14:16.829 15495-15495/ D/AmazonMobileAds AdController: Changing AdState from READY_TO_LOAD to LOADING 10-26 14:14:16.841 15495-15612/ V/AmazonMobileAds GooglePlayServicesAdapter: The Google Play Services Advertising Identifier was successfully retrieved. 10-26 14:14:16.841 15495-15612/ D/AmazonMobileAds AdvertisingIdentifier: No transition detected. 10-26 14:14:16.847 15495-15615/ V/AmazonMobileAds GooglePlayServicesAdapter: The Google Play Services Advertising Identifier was successfully retrieved. 10-26 14:14:16.847 15495-15615/ D/AmazonMobileAds AdvertisingIdentifier: No transition detected. 10-26 14:14:16.997 15495-15615/ V/AmazonMobileAds GooglePlayServicesAdapter: The Google Play Services Advertising Identifier was successfully retrieved. 10-26 14:14:16.997 15495-15615/ D/AmazonMobileAds AdvertisingIdentifier: No transition detected. 10-26 14:14:17.000 15495-15612/ V/AmazonMobileAds GooglePlayServicesAdapter: The Google Play Services Advertising Identifier was successfully retrieved. 10-26 14:14:17.000 15495-15612/ D/AmazonMobileAds AdvertisingIdentifier: No transition detected. 10-26 14:14:17.002 15495-15612/ D/AmazonMobileAds MetricsCollector: METRIC Increment AD_COUNTER_IDENTIFIED_DEVICE 10-26 14:14:17.004 15495-15612/ D/AmazonMobileAds MetricsCollector: METRIC Stop AD_LOAD_LATENCY_LOADAD_TO_FETCH_THREAD_REQUEST_START 10-26 14:14:17.004 15495-15612/ D/AmazonMobileAds MetricsCollector: METRIC Start AD_LOAD_LATENCY_FETCH_THREAD_SPIN_UP 10-26 14:14:17.007 15495-15552/ D/AmazonMobileAds MetricsCollector: METRIC Stop AD_LOAD_LATENCY_FETCH_THREAD_SPIN_UP 10-26 14:14:17.007 15495-15552/ D/AmazonMobileAds MetricsCollector: METRIC Start AD_LOAD_LATENCY_FETCH_THREAD_START_TO_AAX_GET_AD_START 10-26 14:14:17.008 15495-15552/ D/AmazonMobileAds MetricsCollector: METRIC Publish ASSETS_ENSURED_LATENCY 10-26 14:14:17.008 15495-15552/ D/AmazonMobileAds MetricsCollector: METRIC Start AD_LOAD_LATENCY_CREATE_AAX_GET_AD_URL 10-26 14:14:17.133 15495-15552/ D/AmazonMobileAds AdLocation: Setting lat/long using GPS determined by distance 10-26 14:14:17.140 15495-15552/ D/AmazonMobileAds MetricsCollector: METRIC Stop AD_LOAD_LATENCY_CREATE_AAX_GET_AD_URL 10-26 14:14:17.140 15495-15552/ D/AmazonMobileAds MetricsCollector: METRIC Stop AD_LOAD_LATENCY_FETCH_THREAD_START_TO_AAX_GET_AD_START 10-26 14:14:17.140 15495-15552/ D/AmazonMobileAds MetricsCollector: METRIC Increment TLS_ENABLED 10-26 14:14:17.140 15495-15552/ D/AmazonMobileAds MetricsCollector: METRIC Start AAX_LATENCY_GET_AD 10-26 14:14:17.144 15495-15552/ D/AmazonMobileAds AdRequest WebRequest HttpURLConnectionWebRequest: POST https://aax-us-east.amazon-adsystem.com/e/msdk/ads 10-26 14:14:17.144 15495-15552/ D/AmazonMobileAds AdRequest WebRequest HttpURLConnectionWebRequest: Request Body: {"appId":"9XXXXXXXXXXXX4","pk":[],"ua":"Dalvik\/2.1.0 (Linux; U; Android 5.1.1; Nexus 4 Build\/LMY48T) AmazonAdSDK-Android\/5.6.20","adsdk":"amznAdSDK-android-5.6.20","geoloc":"XX.XXXXXXX,-XX.XXXXXX","dinfo":{"make":"LGE","model":"Nexus 4","os":"Android","osVersion":"5.1.1","scalingFactor":"2.0","language":"en","country":"US","carrier":"T-Mobile","orientation":"portrait","screenSize":"768x1184","connectionType":"Wifi"},"pkg":{"lbl":"XYZ","pn":"","v":"9","vn":"1.0"},"isTest":true,"ad-id":"A7jwWyIWwEZHjQCDgltnY4Y","idfa":"2907ae49-856a-4b44-9d94-03483c790f9e","oo":false,"slots":[{"sz":"auto","slot":"portrait","mxsz":"0x0","slotId":1,"supportedMediaTypes":["DISPLAY","VIDEO"],"video":{"minAdDuration":0,"maxAdDuration":30000}}]} 10-26 14:14:18.410 15495-15552/ D/AmazonMobileAds MetricsCollector: METRIC Stop AAX_LATENCY_GET_AD 10-26 14:14:18.410 15495-15552/ D/AmazonMobileAds AdRequest WebRequest HttpURLConnectionWebRequest: Response: 200 OK 10-26 14:14:18.410 15495-15552/ D/AmazonMobileAds MetricsCollector: METRIC Start AD_LOAD_LATENCY_AAX_GET_AD_END_TO_FETCH_THREAD_END 10-26 14:14:18.410 15495-15552/ D/AmazonMobileAds ResponseReader AdRequest WebRequest HttpURLConnectionWebRequest: Response Body: {"instrPixelURL":" http://aax-us-east.amazon-adsystem.com/x/px/p/egvFKGV6PFCTpk.XGl607A/","errorMessage":"no results","errorCode":"503","status":"error"} 10-26 14:14:18.411 15495-15552/ W/AmazonMobileAds AdLoader: Server Message: no results; code: 503 10-26 14:14:18.411 15495-15552/ D/AmazonMobileAds MetricsCollector: METRIC Stop AD_LOAD_LATENCY_AAX_GET_AD_END_TO_FETCH_THREAD_END 10-26 14:14:18.412 15495-15552/ D/AmazonMobileAds MetricsCollector: METRIC Start AD_LOAD_LATENCY_FINALIZE_FETCH_SPIN_UP 10-26 14:14:18.412 15495-15495/ D/AmazonMobileAds MetricsCollector: METRIC Stop AD_LOAD_LATENCY_FINALIZE_FETCH_SPIN_UP 10-26 14:14:18.412 15495-15495/ D/AmazonMobileAds MetricsCollector: METRIC Start AD_LOAD_LATENCY_FINALIZE_FETCH_START_TO_FAILURE 10-26 14:14:18.412 15495-15495/ D/AmazonMobileAds MetricsCollector: METRIC Stop AD_LATENCY_TOTAL 10-26 14:14:18.412 15495-15495/ D/AmazonMobileAds MetricsCollector: METRIC Stop AD_LOAD_LATENCY_FINALIZE_FETCH_START_TO_FAILURE 10-26 14:14:18.412 15495-15495/ D/AmazonMobileAds MetricsCollector: METRIC Stop AD_LATENCY_TOTAL_FAILURE 10-26 14:14:18.412 15495-15495/ D/AmazonMobileAds MetricsCollector: METRIC Increment AD_LOAD_FAILED 10-26 14:14:18.412 15495-15495/ D/AmazonMobileAds MetricsCollector: METRIC Stop AD_LATENCY_RENDER_FAILED 10-26 14:14:18.412 15495-15495/ D/AmazonMobileAds MetricsCollector: METRIC Increment WIFI_PRESENT 10-26 14:14:18.413 15495-15495/ D/AmazonMobileAds MetricsCollector: METRIC Set CARRIER_NAME: T-Mobile 10-26 14:14:18.413 15495-15495/ D/AmazonMobileAds MetricsCollector: METRIC Increment ADLAYOUT_HEIGHT_ZERO 10-26 14:14:18.413 15495-15495/ D/AmazonMobileAds MetricsCollector: METRIC Set VIEWPORT_SCALE: n 10-26 14:14:18.413 15495-15495/ D/AmazonMobileAds AdController: Changing AdState from LOADING to READY_TO_LOAD 10-26 14:14:18.414 15495-15495/ D/AmazonMobileAds Metrics: METRIC Submit and Reset 10-26 14:14:18.417 15495-15495/ D/AmazonMobileAds DefaultAdListener: Default ad listener called - Ad Failed to Load. Error code: NO_FILL, Error Message: Server Message: no results 10-26 14:14:18.423 15495-15552/ D/AmazonMobileAds WebRequest: GET http://aax-us-east.amazon-adsystem.com/x/px/p/egvFKGV6PFCTpk.XGl607A/%22c%22%3A%22msdk%22%2C%22v%22%3A%225.6.20%22%2C%22llfsl%22%3A177%2C%22lfsul%22%3A3%2C%22lcaul%22%3A132%2C%22lfsasl%22%3A133%2C%22al%22%3A1270%2C%22laefel%22%3A2%2C%22lffsul%22%3A0%2C%22tl%22%3A1585%2C%22lffsfl%22%3A0%2C%22tfl%22%3A1585%2C%22car%22%3A%22T-Mobile%22%2C%22vs%22%3A%22n%22%2C%22lf%22%3A1%2C%22ahz%22%3A1%2C%22tls%22%3A1%2C%22wifi%22%3A1%2C%22id%22%3A1%2C%22lael%22%3A0 10-26 14:14:18.482 15495-15552/ D/AmazonMobileAds WebRequest: Response: 200 OK 10-26 14:14:36.743 15495-15495/ D/AmazonMobileAds AdCloser: Ad is attempting to close.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Andrew@Amazon avatar image
Andrew@Amazon answered
Hi Alex. It appears that your LayoutParams are set to WRAP_CONTENT x WRAP_CONTENT. Auto Ad Size needs to know the maximum size of the container before it requests an ad so that it knows what size ad can fit into the container. The easiest way to accomplish this is to use MATCH_PARENT x WRAP_CONTENT, which will allow the ad to be as wide as the parent it is placed into. That should fix the issue with no fills. As for the callbacks not being fired, it appears as though you have not implemented the onAdFailedToLoad() callback. The DefaultAdListener is being called when the ad fails, which indicates a possibility of two scenarios: 1. You extended DefaultAdListener but have not overridden the default onAdFailedToLoad() method. 2. You have not set a custom AdListener using the adLayout.setListener() API.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.