问题描述
我被一个问题困住了一段时间,我不知道它是什么.问题是我最近更新了 Mopub Android SDK,在此之前,插页式 + 横幅广告(AdMob 和 Millennial Media)都运行良好.现在这些广告在发布版本中不起作用,但它们在调试版本中起作用.所以我认为这是 proguard
的问题,但我无法追踪它是什么.proguard
是根据 Mopub 指南设置的.
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.
我在 proguard
中为我的项目添加了以下内容:
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.
我也不知道这是否相关,但我正在开发一个 Cocos2dx Android 项目.
Also I don't know if this is relevant or not but I'm working on a Cocos2dx Android project.
谢谢.
推荐答案
确实是ProGuard
.如果您不希望它完全摆脱" Mopub
、AdMob
和 MMedia
代码,只需将以下行放入 proguard-project.txt
项目文件:
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.** {*;}
这篇关于Mopub 广告未展示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!