I use MoPub under AdMob mediation.
To reduce APK size, I’d like to use MoPub modular dependencies, as I only use banner ads.
But there seems to be a bug: some “Native ads” code is called (apparently by the AdMob adapter) when a banner is shown, leading to a NoClassDefFoundError exception and app crash.
Please advise how to fix this issue.
build.gradle:
implementation('com.mopub:mopub-sdk-banner:5.3.0@aar') {
transitive = true
}
implementation('com.google.ads.mediation:mopub:5.3.0.1')
Stack trace:
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/mopub/nativeads/NativeErrorCode;
at com.mopub.mobileads.dfp.adapters.MoPubAdapter$4.<clinit>(MoPubAdapter.java:209)
at com.mopub.mobileads.dfp.adapters.MoPubAdapter$MBannerListener.onBannerFailed(MoPubAdapter.java:401)
at com.mopub.mobileads.MoPubView.adFailed(MoPubView.java:237)
at com.mopub.mobileads.AdViewController.adDidFail(AdViewController.java:550)
at com.mopub.mobileads.AdViewController.onAdLoadError(AdViewController.java:172)
at com.mopub.mobileads.AdViewController$1.onErrorResponse(AdViewController.java:124)
at com.mopub.network.AdLoader.deliverError(AdLoader.java:266)
at com.mopub.network.AdLoader.access$200(AdLoader.java:26)
at com.mopub.network.AdLoader$1.onErrorResponse(AdLoader.java:81)
at com.mopub.volley.Request.deliverError(Request.java:630)
at com.mopub.volley.ExecutorDelivery$ResponseDeliveryRunnable.run(ExecutorDelivery.java:108)
at android.os.Handler.handleCallback(Handler.java:809)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:166)
at android.app.ActivityThread.main(ActivityThread.java:7377)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:469)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:963)