Mopub广告未显示

6
I've been stuck on an issue related to IT technology for a while and I can't figure out what's causing it. Recently, I updated the Mopub Android SDK and both interstitial and banner ads from AdMob and Millennial Media were working fine before that. However, now these ads aren't working in the release build but they do work in debug builds. Therefore, I suspect that this is an issue with ProGuard, but I can't identify the root cause. The ProGuard setup is based on Mopub guidelines.
For my project, I have added the following code to ProGuard:
-keep class com.google.ads.**
-keep class com.millennialmedia.android.**
-keep public class com.mopub.mobileads.*
-keepclassmembers class com.millennialmedia.android.* {
public *;
}

在发布版本中,当我尝试显示广告时,会出现以下日志:
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.

请提出错误可能是什么。欢迎任何反馈意见。
另外,我不知道这是否相关,但我正在开发一个Cocos2dx Android项目。
谢谢。
2个回答

8

确实是ProGuard。如果您不希望它完全“摆脱”MopubAdMobMMedia的代码,请将以下行放入项目的proguard-project.txt文件中:

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

1
对我有用!只需要包含-dontwarn com.millennialmedia.android.NVASpeechKit*就可以让它工作。 - AlexGuti

1

你需要创建一个自定义的本地网络,并将自定义类添加到 mopub 网站中。与 millennial 相同,并确保在项目中添加了必要的适配器。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接