googleads-mobile-android-mediation icon indicating copy to clipboard operation
googleads-mobile-android-mediation copied to clipboard

MopubAdapter - ClassCastException

Open gawy-d opened this issue 5 years ago • 3 comments

Hi,

Since Mopub mediation adapter v5.4.1.2 a ClassCastException occurs while loading native ads. As b124a760c5c5b9667b4cabd12d56d674f9f1c56e a modification has been made during Mopub SDK initialization where now the Context is cast to an Activity, which is not necessary in this case (native ads) as the Mopub SDK already checks if the Context is an Activity only to handle Rewarded Videos.

For now I keep the previous version (5.4.1.1) that works for native ads with an Application Context, but it would be nice to keep the Context as it is without casting it, at least for native ads.

Thanks

gawy-d avatar May 15 '19 15:05 gawy-d

Agree, it is a bit unexpected, because admob InterstitalAd class doesn't need Activity context, but then you got runtime exception because MoPub does.

xgear-public avatar Jun 12 '19 13:06 xgear-public

Hi All,

Tried on my end and I was not able to see any ClassCastException in the logs when loading any ad format. Can you try using the latest 5.7.1.0 MoPub adapter and see if you can see the exception popping up? If so, then kindly share with us device logs for us to investigate further.

joshuajplagonera avatar Jun 28 '19 19:06 joshuajplagonera

@joshuajplagonera That happened when I pass ApplicationContext instead of Activity in AdLoader.Builder(), I can confirm it happened on 5.7.1.0 also.

hiirene avatar Jul 01 '19 18:07 hiirene