I get "nextRation is null!" error trying to use Adwhirl + AdMob in Android

496 Views Asked by At

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.

2

There are 2 best solutions below

0
On

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.

0
On

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.