6

I've been stuck on an issue for a while and I can't figure out what it is. The thing is I recently updated the Mopub Android SDK and both interstitial + banner ads (AdMob and Millennial Media) were working fine before that. Now these ads aren't working in the release build but they do work in debug build. So I think this is an issue with proguard but I can't trace what it is. The proguard is setup according to Mopub guidelines.

I have added the following to proguard for my project:

-keep class com.google.ads.**
-keep class com.millennialmedia.android.**
-keep public class com.mopub.mobileads.*
-keepclassmembers class com.millennialmedia.android.* {
public *;
}

In the release build, when I try to display an ad I get the following logs :

I/MoPub   (29856): Fetching ad network type: admob_native
D/MoPub   (29856): Loading custom event interstitial adapter.
D/MoPub   (29856): Attempting to invoke custom event: com.mopub.mobileads.GoogleAdMobInterstitial
D/MoPub   (29856): Couldn't locate or instantiate custom event: com.mopub.mobileads.GoogleAdMobInterstitial.

I/MoPub   (29856): Fetching ad network type: admob_native
D/MoPub   (29856): Loading custom event adapter.
D/MoPub   (29856): Attempting to invoke custom event: com.mopub.mobileads.GoogleAdMobBanner
D/MoPub   (29856): Couldn't locate or instantiate custom event: com.mopub.mobileads.GoogleAdMobBanner.
V/MoPub   (29856): MoPubErrorCode: Unable to find Native Network or Custom Event adapter.

Please suggest what the error might be. Any feedback would be appreciated.

Also I don't know if this is relevant or not but I'm working on a Cocos2dx Android project.

Thanks.

Onik
  • 15,592
  • 10
  • 57
  • 79
EvG9
  • 227
  • 3
  • 11

2 Answers2

8

It is ProGuard indeed. If you don't want it to "get rid" of Mopub, AdMob and MMedia code entirely, just put the following lines into proguard-project.txt file of your project:

    -keep class com.google.ads.** {*;}
    -keep class com.mopub.mobileads.** {*;}
    -keep class com.millennialmedia.android.** {*;}
    -keep class com.millennialmedia.google.** {*;}
Onik
  • 15,592
  • 10
  • 57
  • 79
  • 1
    Worked for me! Just had to include `-dontwarn com.millennialmedia.android.NVASpeechKit*` to have it working – AlexGuti Apr 10 '14 at 12:58
0

You need to create a custom native network and add your custom class in mopub site. Same with millennial and make sure you added necessary adaptors in your project.

CIgiA
  • 190
  • 8