Mopub banners on pixel 2 Code Answer

Hello Developer, Hope you guys are doing great. Today at Tutorial Guruji Official website, we are sharing the answer of Mopub banners on pixel 2 without wasting too much if your time.

The question is published on by Tutorial Guruji team.

I am using mopub advertising, and have some troubles with Native banners on one of the devices, pixel 2 with 10 android. On other devices everything works fine. To fix this bug, I have updated library to last version 5.9.1, but it doesn’t help me When I am trying to test Mopub sample application, everything works fine. ad unit id: 11a17b188668469fb0412708c3d16813

I init sdk with Activity context, and using something like this:

MoPubNative moPubNative = new MoPubNative(context, adUnitId, moPubNativeListener)

In the MoPubNative.MoPubNativeNetworkListener callback, I got onNativeFail

In the log, I see this:

Initialized adapters:
No adapters initialized.
2019-10-27 17:37:21.429 2774-3136/com.sample.app I/MoPub: [com.mopub.common.util.AsyncTasks][safeExecuteOnExecutor] SDK Log - Posting AsyncTask to main thread for execution.
2019-10-27 17:37:21.603 2774-2774/com.sample.app I/MoPub: [com.mopub.nativeads.MoPubNative][loadNativeAd] Ad attempting to load
2019-10-27 17:37:21.610 2774-2774/com.sample.app I/MoPub: [com.mopub.nativeads.MoPubNative][loadNativeAd] Ad Log - MoPubNative Loading ad from: https://ads.mopub.com/m/ad?id=11a17b188668469fb0412708c3d16813&nv=5.9.1&dn=Google%2CPixel%202%2Cwalleye&bundle=com.sample.app&q=HADNT_RAIL_ORDER%3A1%2CHAD_ORDER%3A1%2Cauthorized%3Atrue%2CHADNT_HOTEL_ORDER%3A1%2Clanguage%3Aru%2CHAS_MOBILE_ORDER%3A1%2CPOSITIVE_FEEDBACK%3A1%2Cregion%3Aru%2Cversion%3A2%2CHADNT_AVIA_ORDER%3A1&z=%2B0300&o=p&cw=0&ch=0&w=1080&h=1920&sc=2.8375&ct=2&av=8.5.2&udid=mp_tmpl_advertising_id&dnt=mp_tmpl_do_not_track&mid=mp_tmpl_mopub_id&gdpr_applies=0&force_gdpr_applies=0&current_consent_status=unknown
2019-10-27 17:37:21.620 2774-2774/com.sample.app I/MoPub: [com.mopub.network.AdLoader][fetchAd] Ad requesting from AdServer: https://ads.mopub.com/m/ad
{"ch":"0","nv":"5.9.1","h":"1920","force_gdpr_applies":"0","mid":"25ebd28c-90dc-4a18-a63d-6ef71aa6a860","dn":"Google,Pixel 2,walleye","dnt":"0","o":"p","sc":"2.8375","q":"HADNT_RAIL_ORDER:1,HAD_ORDER:1,authorized:true,HADNT_HOTEL_ORDER:1,language:ru,HAS_MOBILE_ORDER:1,POSITIVE_FEEDBACK:1,region:ru,version:2,HADNT_AVIA_ORDER:1","ct":"2","current_consent_status":"unknown","cw":"0","av":"8.5.2","w":"1080","z":"+0300","id":"11a17b188668469fb0412708c3d16813","udid":"ifa:219b0f17-61cd-4a48-8053-0740e0660240","bundle":"com.sample.app","gdpr_applies":"0"}
2019-10-27 17:37:22.499 2774-2774/com.sample.app I/MoPub: [com.mopub.network.TrackingRequest$1][onResponse] SDK Log - Successfully hit tracking endpoint: https://ads.mopub.com/m/open
2019-10-27 17:37:22.573 2774-3135/com.sample.app I/MoPub: [com.mopub.network.MultiAdResponse][parseSingleAdResponse] Ad server responded with:
{"content":"{"clk":"https://www.mopub.com/click-test/","clktracker":"https://ads.mopub.com/m/aclk?appid=&cid=7c948393790a4db2be8d5de6a26bf202&city=Moscow&ckv=2&country_code=RU&cppck=84393&current_consent_status=unknown&dev=Pixel%202&exclude_adgroups=365cd2475e074026b93da14103a36b97&gdpr_applies=0&id=11a17b188668469fb0412708c3d16813&is_mraid=0&os=Android&osv=10.0.0&priority=5&req=25dc7bcdaade4a56bc44c47c9d46b739_001d8b80002c3660&reqt=1572359810.0&rev=0&udid=ifa%3A219b0f17-61cd-4a48-8053-0740e0660240&video_type=","ctatext":"Go","iconimage":"https://d30x8mtr3hjnzo.cloudfront.net/creatives/6591163c525f4720b99abf831ca247f6","imptracker":["https://ads.mopub.com/m/imp?appid=&cid=7c948393790a4db2be8d5de6a26bf202&city=Moscow&ckv=2&country_code=RU&cppck=DB670&current_consent_status=unknown&dev=Pixel%202&exclude_adgroups=365cd2475e074026b93da14103a36b97&gdpr_applies=0&id=11a17b188668469fb0412708c3d16813&is_mraid=0&os=Android&osv=10.0.0&priority=5&req=25dc7bcdaade4a56bc44c47c9d46b739_001d8b80002c3660&reqt=1572359810.0&rev=0.000050&udid=ifa%3A219b0f17-61cd-4a48-8053-0740e0660240&video_type="],"mainimage":"https://d30x8mtr3hjnzo.cloudfront.net/creatives/8d0a2ba02b2b485f97e1867366762951","text":"Success! Your integration is ready to go. Tap to test this ad. ","title":"MoPub"}","metadata":{"content-type":"application/json; charset=UTF-8","impdata":{"adgroup_id":"365cd2475e074026b93da14103a36b97","adgroup_name":"Non-Mrect Ads","adgroup_priority":6,"adgroup_type":"gtee","adunit_format":"Native","adunit_id":"11a17b188668469fb0412708c3d16813","adunit_name":"Android Sample App Native","country":"RU","currency":"USD","id":"25dc7bcdaade4a56bc44c47c9d46b739_001d8b80002c3660","precision":"publisher_defined","publisher_revenue":5.0E-5},"x-ad-timeout-ms":10000,"x-adgroupid":"365cd2475e074026b93da14103a36b97","x-adtype":"json","x-after-load-url":"https://cb.mopub.com/load?account_id=1308c11342c349e8a2934d8bb8fd33f6&adgroup_id=365cd2475e074026b93da14103a36b97&adgroup_type=gtee&adunit_format=Native&adunit_id=11a17b188668469fb0412708c3d16813&app_id=108e64891ab140adbe7d2325510533e9&connection_type=2&country=RU&is_mraid=0&os=Android&request_id=25dc7bcdaade4a56bc44c47c9d46b739_001d8b80002c3660&request_ts_ms=1572359810&sdk_version=5.9.1&load_result=%%LOAD_RESULT%%&load_duration_ms=%%LOAD_DURATION_MS%%","x-before-load-url":"https://ads.mopub.com/m/attempt?cid=7c948393790a4db2be8d5de6a26bf202&country_code=RU&cppck=7F4D2&current_consent_status=unknown&gdpr_applies=0&id=11a17b188668469fb0412708c3d16813&logged_server_side=0&pf=1&pfs=&req=25dc7bcdaade4a56bc44c47c9d46b739_001d8b80002c3660&reqt=1572359810.0&rtc=0","x-browser-agent":0,"x-clickthrough":"https://ads.mopub.com/m/aclk?appid=&cid=7c948393790a4db2be8d5de6a26bf202&city=Moscow&ckv=2&country_code=RU&cppck=84393&current_consent_status=unknown&dev=Pixel%202&exclude_adgroups=365cd2475e074026b93da14103a36b97&gdpr_applies=0&id=11a17b188668469fb0412708c3d16813&is_mraid=0&os=Android&osv=10.0.0&priority=5&req=25dc7bcdaade
2019-10-27 17:37:22.573 2774-3135/com.sample.app I/MoPub: [com.mopub.network.MultiAdResponse][parseSingleAdResponse] 4a56bc44c47c9d46b739_001d8b80002c3660&reqt=1572359810.0&rev=0&udid=ifa%3A219b0f17-61cd-4a48-8053-0740e0660240&video_type=","x-creativeid":"7c948393790a4db2be8d5de6a26bf202","x-impression-min-visible-percent":"1","x-impression-visible-ms":"1","x-imptracker":"https://ads.mopub.com/m/imp?appid=&cid=7c948393790a4db2be8d5de6a26bf202&city=Moscow&ckv=2&country_code=RU&cppck=DB670&current_consent_status=unknown&dev=Pixel%202&exclude_adgroups=365cd2475e074026b93da14103a36b97&gdpr_applies=0&id=11a17b188668469fb0412708c3d16813&is_mraid=0&os=Android&osv=10.0.0&priority=5&req=25dc7bcdaade4a56bc44c47c9d46b739_001d8b80002c3660&reqt=1572359810.0&rev=0.000050&udid=ifa%3A219b0f17-61cd-4a48-8053-0740e0660240&video_type=","x-refreshtime":60}}
2019-10-27 17:37:22.697 2774-2774/com.sample.app I/MoPub: [com.mopub.nativeads.CustomEventNativeAdapter][loadNativeAd] SDK Log - 
2019-10-27 17:37:22.698 2774-2774/com.sample.app I/MoPub: [com.mopub.nativeads.MoPubCustomEventNative][loadNativeAd] Adapter MoPubCustomEventNative attempting to load ad
2019-10-27 17:37:22.707 2774-2774/com.sample.app I/MoPub: [com.mopub.nativeads.MoPubCustomEventNative][loadNativeAd] Adapter MoPubCustomEventNative successfully loaded ad
2019-10-27 17:37:23.112 2774-2774/com.sample.app I/MoPub: [com.mopub.network.TrackingRequest$1][onResponse] SDK Log - Successfully hit tracking endpoint: https://ads.mopub.com/m/attempt
2019-10-27 17:37:23.595 2774-2774/com.sample.app I/MoPub: [com.mopub.nativeads.NativeImageHelper$1][onErrorResponse] SDK Error Log - Failed to download a native ads image:, com.mopub.volley.NoConnectionError: javax.net.ssl.SSLHandshakeException: Chain validation failed
2019-10-27 17:37:23.597 2774-2774/com.sample.app I/MoPub: [com.mopub.nativeads.CustomEventNativeAdapter$2][onNativeAdFailed] SDK Log - onNativeAdFailed with code 10000 and message Unable to download images associated with ad.
2019-10-27 17:37:23.599 2774-2774/com.sample.app I/MoPub: [com.mopub.nativeads.MoPubNative$3][onNativeAdFailed] Ad failed to load: (10 000) Unable to download images associated with ad.
2019-10-27 17:37:23.609 2774-2774/com.sample.app I/MoPub: [com.mopub.network.AdLoader][fetchAd] Ad requesting from AdServer: https://ads.mopub.com/m/ad
{"nv":"5.9.1","mid":"25ebd28c-90dc-4a18-a63d-6ef71aa6a860","dn":"Google,Pixel 2,walleye","sc":"2.8375","current_consent_status":"unknown","tqr":"XbhOgqViv6KeDQjQVEDX8OCarltShfuTV4Qpvg","exclude":"365cd2475e074026b93da14103a36b97","id":"11a17b188668469fb0412708c3d16813","udid":"ifa:219b0f17-61cd-4a48-8053-0740e0660240","bundle":"com.sample.app","gdpr_applies":"0","rtc":"1","ac":"0","ch":"0","force_gdpr_applies":"0","h":"1920","dnt":"0","cppck":"6330F","o":"p","ct":"2","q":"HADNT_RAIL_ORDER:1,HAD_ORDER:1,authorized:true,HADNT_HOTEL_ORDER:1,language:ru,HAS_MOBILE_ORDER:1,POSITIVE_FEEDBACK:1,region:ru,version:2,HADNT_AVIA_ORDER:1","cw":"0","av":"8.5.2","w":"1080","z":"+0300","request_id":"25dc7bcdaade4a56bc44c47c9d46b739_001d8b80002c3660"}
2019-10-27 17:37:23.610 2774-2774/com.sample.app I/MoPub: [com.mopub.nativeads.NativeImageHelper$1][onErrorResponse] SDK Error Log - Failed to download a native ads image:, com.mopub.volley.NoConnectionError: javax.net.ssl.SSLHandshakeException: Chain validation failed
2019-10-27 17:37:24.148 2774-3137/com.sample.app I/MoPub: [com.mopub.network.MultiAdResponse][parseSingleAdResponse] Ad server responded with:
{"content":"","metadata":{"x-adtype":"clear","x-backfill":"clear","x-refreshtime":60}}
2019-10-27 17:37:24.149 2774-2774/com.sample.app I/MoPub: [com.mopub.network.AdLoader$1][onErrorResponse] Ad server responded with:
No ads found for ad unit.
2019-10-27 17:37:24.149 2774-2774/com.sample.app I/MoPub: [com.mopub.nativeads.MoPubNative][onAdError] Ad Log - Native ad request failed.
2019-10-27 17:37:24.896 2774-2774/com.sample.app I/MoPub: [com.mopub.network.TrackingRequest$1][onResponse] SDK Log - Successfully hit tracking endpoint: https://cb.mopub.com/load?account_id=1308c11342c349e8a2934d8bb8fd33f6&adgroup_id=365cd2475e074026b93da14103a36b97&adgroup_type=gtee&adunit_format=Native&adunit_id=11a17b188668469fb0412708c3d16813&app_id=108e64891ab140adbe7d2325510533e9&connection_type=2&country=RU&is_mraid=0&os=Android&request_id=25dc7bcdaade4a56bc44c47c9d46b739_001d8b80002c3660&request_ts_ms=1572359810&sdk_version=5.9.1&load_result=invalid_data&load_duration_ms=904

When I looked to log with same code on another device, I saw that diff:

9-10-27 17:37:23.595 2774-2774/com.sample.app I/MoPub: [com.mopub.nativeads.NativeImageHelper$1][onErrorResponse] SDK Error Log - Failed to download a native ads image:, com.mopub.volley.NoConnectionError: javax.net.ssl.SSLHandshakeException: Chain validation failed
2019-10-27 17:37:23.597 2774-2774/com.sample.app I/MoPub: [com.mopub.nativeads.CustomEventNativeAdapter$2][onNativeAdFailed] SDK Log - onNativeAdFailed with code 10000 and message Unable to download images associated with ad.

But unfortunately it didn’t helped me

Answer

After some investigate, i saw incorrect time on my test device So, https didn’t work correctly

We are here to answer your question about Mopub banners on pixel 2 - If you find the proper solution, please don't forgot to share this with your team members.

Related Posts

Tutorial Guruji