Context:
I use AdMob mediation to display banners in my application. I have included the multi-core ad network SDK and AdMob for millennia.
Problem: my application supports Android API 9+, while the Millennial SDK supports API 16+. Even worse, instead of gracefully failing (without returning the ad to the AdMob mediation level so that it can continue to go down the mediation waterfall), the SDK crashes on devices running Android <16 ( Fatal Exception: java.lang.NoSuchMethodError android.webkit.WebSettings.setAllowUniversalAccessFromFileURLs )
Apparently, Millennial developers do not plan to fix this, they recommend publishing 2 different APKs ("<16" without their SDK and "16+" with their SDK), which is a difficult decision.
I would prefer a simpler solution: on devices running the Android API <16, I would like to reproduce what happens when the AdMob adapter is missing: AdMob mediation simply moves on to the next network. This would mean unloading or erasing the Millennial adapter class before I create the AdMod mediation banner.
Question :
Is there any way to prevent the future build of this class (from a third-party library) at runtime? (for example, by forcibly excluding ClassNotFound)
source share