Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mopub ads not showing

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.

like image 277
EvG9 Avatar asked Sep 03 '13 11:09

EvG9


1 Answers

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.** {*;}
like image 190
Onik Avatar answered Oct 17 '22 05:10

Onik