[SOLVED] MoPub 4.0 native ad InflateException



UPDATE: This has been fixed in MoPub 4.1.0.

MoPub 4.0 gets an InflateException if your <application> element in AndroidManifest.xml does not have an android:theme attribute.

The problem is in NativeAd, in MoPub 4.0 the constructor changed to mContext = context.getApplicationContext();. So in NativeAd.createAdView() it passes the Application Context to the ad renderer for View inflation. But application contexts in general are not required to have a theme. So it chokes when trying to resolve Android resource attributes.

My proposed fix is here: https://github.com/mopub/mopub-android-sdk/pull/184