MoPub - 广告无法加载

时间:2014-12-22 18:30:56

标签: android ads mopub

我对下面的错误感到困惑,不知道错误在哪里,感谢任何帮助。

代码:

mopubView = (MoPubView) mainLayout.findViewById(R.id.mopubAdView);
mopubView.setAdUnitId("a19bd46992bc44c8959c13cc25f60e9c");
mopubView.setLayoutParams(params);
mopubView.loadAd();

查看XML代码:

<com.mopub.mobileads.MoPubView
        android:id="@+id/mopubAdview"
        android:layout_width="fill_parent"
        android:layout_height="50dp" />

清单文件的一瞥:

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

<other settings />

<activity
    android:name="com.mopub.mobileads.MoPubActivity"
    android:configChanges="keyboardHidden|orientation" />
<activity
    android:name="com.mopub.mobileads.MraidActivity"
    android:configChanges="keyboardHidden|orientation" />
<activity
    android:name="com.mopub.common.MoPubBrowser"
    android:configChanges="keyboardHidden|orientation|screenSize" />
<activity
    android:name="com.mopub.mobileads.MraidBrowser"
    android:configChanges="keyboardHidden|orientation" />
<activity
    android:name="com.mopub.mobileads.MraidVideoPlayerActivity"
    android:configChanges="keyboardHidden|orientation" />
<activity
    android:name="com.google.ads.AdActivity"
    android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
<activity
    android:name="com.millennialmedia.android.MMActivity"
    android:configChanges="keyboardHidden|orientation|keyboard"
    android:theme="@android:style/Theme.Translucent.NoTitleBar" />
<activity
    android:name="com.millennialmedia.android.VideoPlayer"
    android:configChanges="keyboardHidden|orientation|keyboard" />

Logcat输出

In AndroidManifest, the android:configChanges param is missing values for the following MoPub activities:
    The android:configChanges param for activity com.mopub.mobileads.MoPubActivity must include screenSize.
    The android:configChanges param for activity com.mopub.mobileads.MraidActivity must include screenSize.
    The android:configChanges param for activity com.mopub.mobileads.MraidVideoPlayerActivity must include screenSize.
Please update your manifest to include them.
In AndroidManifest, the android:configChanges param is missing values for the following MoPub activities:
    The android:configChanges param for activity com.mopub.mobileads.MoPubActivity must include screenSize.
    The android:configChanges param for activity com.mopub.mobileads.MraidActivity must include screenSize.
    The android:configChanges param for activity com.mopub.mobileads.MraidVideoPlayerActivity must include screenSize.
Please update your manifest to include them.
Loading url: http://ads.mopub.com/m/ad?v=6&id=a19bd46992bc44c8959c13cc25f60e9c&nv=3.3.0&dn=samsung%2CSAMSUNG-SGH-I337%2Cjflteuc&udid=ifa%3A937232dd-fa11-424f-94a0-f84897b305f4&ll=39.26126126126126%2C-84.33420242467194&lla=2000&llsdk=1&z=-0500&o=p&sc_a=3.0&mr=1&mcc=310&mnc=410&iso=us&cn=AT%26T&ct=2&av=1.02&android_perms_ext_storage=1&ts=1
Ad Unit (a19bd46992bc44c8959c13cc25f60e9c) is still warming up. Please try again in a few minutes.
Ad failed to load.

2 个答案:

答案 0 :(得分:3)

以下对活动的更新解决了问题,MoPub文档没有说明这一点,但是当你带上应用程序时,你会收到这个错误,我已经创建了一个MoPub的问题来研究这个并更新他们的文档,如果需要的。

<activity
    android:name="com.mopub.mobileads.MoPubActivity"
    android:configChanges="keyboardHidden|orientation|screenSize" />
<activity
    android:name="com.mopub.mobileads.MraidActivity"
    android:configChanges="keyboardHidden|orientation|screenSize" />
<activity
    android:name="com.mopub.common.MoPubBrowser"
    android:configChanges="keyboardHidden|orientation|screenSize" />
<activity
    android:name="com.mopub.mobileads.MraidBrowser"
    android:configChanges="keyboardHidden|orientation|screenSize" />
<activity
    android:name="com.mopub.mobileads.MraidVideoPlayerActivity"
    android:configChanges="keyboardHidden|orientation|screenSize" />
<activity
    android:name="com.google.ads.AdActivity"
    android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
<activity
    android:name="com.millennialmedia.android.MMActivity"
    android:configChanges="keyboardHidden|orientation|keyboard"
    android:theme="@android:style/Theme.Translucent.NoTitleBar" />
<activity
    android:name="com.millennialmedia.android.VideoPlayer"
    android:configChanges="keyboardHidden|orientation|keyboard" />

<强>更新 我已经报告了MoPub的问题,并且mopub wiki上的文档已经更新 - https://github.com/mopub/mopub-android-sdk/issues/134 看起来这个回购的所有者不允许公众提出任何问题< / em>的

答案 1 :(得分:1)

以下是有关Manifest.xml主题的MoPub文档的链接(向下滚动到更新Android Manifest)。它在重要说明中将screenSize视为configChanges。

重要说明
1.如果您正在针对13以下的API进行编译,则应从清单条目中排除“screenSize”。


https://dev.twitter.com/mopub/android/getting-started