我得到“nextRation 为空!”尝试使用 Adwhirl 时出错 + Android 中的 AdMob

发布于 2024-12-26 13:45:35 字数 2318 浏览 1 评论 0 原文

几周来我一直在努力解决这个问题。 StackOverflow 中还有一些其他类似的问题,AdWhirl 文档网站 (一个两个),但这个错误仍然困扰着我。

AdWhirl 文档相当不完整且令人困惑。我执行的步骤:

  • 我创建了一个 AdMob 帐户并获得了 AdMob ID。
  • 我创建了一个 AdWhirl 帐户,将 AdMob ID 放在那里,然后我得到了 AdWhirl ID。
  • 我在我的 Java 构建路径中添加了 AdMob SDK Jar 4.3.1 和 AdWhirl SDK Jar 3.1.1
  • 在我的清单文件中,我添加了以下几行

<manifest>
[...]
<application>
    [...]
    <activity android:name="com.google.ads.AdActivity"
        android:configChanges="orientation|keyboard|keyboardHidden|screenLayout|uiMode|screenSize|smallestScreenSize" />
    <meta-data android:value="[AdWhirl ID]" android:name="ADWHIRL_KEY"/>
</application>

<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> 
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> 
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
</manifest>
  • 在我想要广告的所有布局中,我添加了以下几行:

<com.adwhirl.AdWhirlLayout
    android:id="@+id/adwhirl_layout"
    android:layout_width="fill_parent"
    android:layout_height="72dip" />
  • 在与这些布局相关的所有活动中,我添加了以下几行

public class XXX extends ListActivity implements AdWhirlInterface {
[...]
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.YYY);
        initAds();
        [...]
    }

[...]
    private void initAds() {
        AdWhirlManager.setConfigExpireTimeout(1000 * 60 * 5);
        AdWhirlTargeting.setTestMode(false);
        AdWhirlLayout adWhirlLayout = (AdWhirlLayout)findViewById(R.id.adwhirl_layout);
        adWhirlLayout.setAdWhirlInterface(this);
    }

    public void adWhirlGeneric() {
        Log.e(AdWhirlUtil.ADWHIRL, "In adWhirlGeneric()");
    }
}

项目构建目标:Google API Android 4.0 模拟器:Google API 2.1 (API 7)

我做错了什么?

我没有看到任何广告,而且总是收到“nextRation 为空!”的提示。错误。

I've been trying to solve this problem for weeks. There are some other similar questions in StackOverflow, and there are some (apparently solved) similar issues in AdWhirl documentation website (one and two), but this error is still bothering me.

AdWhirl documentation is rather incomplete and confusing. The steps I've followed:

  • I created an AdMob account and I got the AdMob ID.
  • I created an AdWhirl account, I put there the AdMob ID and I got the AdWhirl ID.
  • I added in my Java Build Path the AdMob SDK Jar 4.3.1 and the AdWhirl SDK Jar 3.1.1
  • In my Manifest file I added the following lines:

.

<manifest>
[...]
<application>
    [...]
    <activity android:name="com.google.ads.AdActivity"
        android:configChanges="orientation|keyboard|keyboardHidden|screenLayout|uiMode|screenSize|smallestScreenSize" />
    <meta-data android:value="[AdWhirl ID]" android:name="ADWHIRL_KEY"/>
</application>

<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> 
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> 
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
</manifest>
  • In all the layouts I want ads I added the following lines:

.

<com.adwhirl.AdWhirlLayout
    android:id="@+id/adwhirl_layout"
    android:layout_width="fill_parent"
    android:layout_height="72dip" />
  • In all the activities related to those layouts I added the following lines:

.

public class XXX extends ListActivity implements AdWhirlInterface {
[...]
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.YYY);
        initAds();
        [...]
    }

[...]
    private void initAds() {
        AdWhirlManager.setConfigExpireTimeout(1000 * 60 * 5);
        AdWhirlTargeting.setTestMode(false);
        AdWhirlLayout adWhirlLayout = (AdWhirlLayout)findViewById(R.id.adwhirl_layout);
        adWhirlLayout.setAdWhirlInterface(this);
    }

    public void adWhirlGeneric() {
        Log.e(AdWhirlUtil.ADWHIRL, "In adWhirlGeneric()");
    }
}

Project Build Target: Google API Android 4.0
Emulator: Google APIs 2.1 (API 7)

What am I doing wrong?

I see no ads and all the time I get the "nextRation is null!" error.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

哆啦不做梦 2025-01-02 13:45:35

这看起来非常像简约的 AdWhirl 实现。仅供参考,您不需要 adWhirlGeneric() 方法。

nextRation 可能为 null 有几个原因。

  1. 在您遇到此问题期间,AdWhirl 服务器可能已关闭,或者您在 AdWhirl UI 中错误配置了某些设置。这些错误不太可能发生。
  2. AdWhirl 尝试请求 AdMob 广告,但由于某种原因失败了(我的钱是因为库存不足),并且 AdWhirl 没有下一个口粮,这意味着没有更多的广告网络可以尝试请求广告(并且它将尝试下次刷新时再次出现)。

注意:AdWhirl 中的Ration 表示广告网络设置,例如网络名称及其相应的网络 ID。

再次检查 logcat 输出,看看是什么导致了 nextRation is null 错误。它是 JSONException 吗?如果是这样,则意味着您遇到了问题#1。日志是否显示您找到了 AdMob 配给,然后 AdMob 响应了 onFailedToReceiveAd,然后您得到 nextRation 为 null?那么你就有了问题#2。

This looks like pretty much like the minimalistic AdWhirl implementation. FYI, you don't need the adWhirlGeneric() method.

There are a couple of reasons nextRation may be null.

  1. The AdWhirl servers may have been down during the time you had this issue, or that you misconfigured some settings in the AdWhirl UI. These errors are unlikely.
  2. AdWhirl tried to request an AdMob ad, and it failed for whatever reason (my money is on lack of inventory), and AdWhirl had no next ration, meaning there are no more ad networks to try to request an ad from (and it will try again on next refresh).

NOTE: A Ration in AdWhirl represents an ad network settings, like network name and it's corresponding network id.

Check the logcat output again, and see what leads up to the nextRation is null error. Is it a JSONException? If so, that means you have issue #1. Do the logs say you found an AdMob ration, then AdMob responded with onFailedToReceiveAd, and then you get nextRation is null? Then you have issue #2.

长不大的小祸害 2025-01-02 13:45:35

我遇到了同样的问题,并在这篇文章之后找到了解决方案:
http://code.google.com/p/adwhirl/issues/detail ?id=27

希望也能帮到你。

I had the same issue and found a solution following this post:
http://code.google.com/p/adwhirl/issues/detail?id=27

Hope it can help you too.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文