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.
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.
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.