Ad request successful, but no ad returned due to lack of ad inventory.

1,819 views
Skip to first unread message

Антон Аверкиев

unread,
Jan 16, 2014, 2:29:24 AM1/16/14
to google-adm...@googlegroups.com
I new in AdMob. At first I'm trying to create a test app with different types of ad.
I use real ad_unit_id and nexus 4 for testing.

I use 1 layout xml for all activity:

    <?xml version="1.0" encoding="utf-8"?>
   
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
       
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
       
android:id="@+id/empty_layout"
       
android:layout_width="fill_parent"
       
android:layout_height="fill_parent"
       
android:orientation="vertical" >
   
</LinearLayout>


When i create simple activity with banner ad it's work fine. Activity code:

    public class AdBannerActivity extends Activity {
       
       
private AdView adView;
       
       
@Override
       
protected void onCreate(Bundle savedInstanceState) {
           
super.onCreate(savedInstanceState);
            setContentView
(R.layout.ad_empty);
           
            adView
= new AdView(this, AdSize.SMART_BANNER, getString(R.string.adUnitId));
            adView
.setAdListener(this);
           
           
LinearLayout layout = (LinearLayout) findViewById(R.id.empty_layout);
           
            layout
.addView(adView);
           
            adView
.loadAd(new AdRequest());
       
}
       
       
@Override
       
public void onDestroy() {
           
if (adView != null) {
                adView
.destroy();
           
}
           
super.onDestroy();
       
}
   
}


When i try to create activity with full screen ad, i have error message:

    Ad request successful, but no ad returned due to lack of ad inventory.


Activity code:

    public class AdInterstitialActivity extends Activity implements AdListener {
       
       
private InterstitialAd interstitial;
   
       
@Override
       
protected void onCreate(Bundle savedInstanceState) {
           
super.onCreate(savedInstanceState);
            setContentView
(R.layout.ad_empty);
           
            interstitial
= new InterstitialAd(this, getString(R.string.adUnitId));
           
            interstitial
.setAdListener(this);
           
           
AdRequest adRequest = new AdRequest();
           
            interstitial
.loadAd(adRequest);
       
}
       
       
@Override
       
public void onReceiveAd(Ad ad) {
           
if (ad == interstitial) {
                interstitial
.show();
           
}
       
}
   
       
@Override
       
public void onDismissScreen(Ad ad) {
       
}
   
       
@Override
       
public void onFailedToReceiveAd(Ad ad, ErrorCode error) {
           
Log.e("AdTest", "Error code: " + error);
       
}
   
       
@Override
       
public void onLeaveApplication(Ad ad) {
       
}
   
       
@Override
       
public void onPresentScreen(Ad ad) {
       
}
   
}


What am I doing wrong?
How to solve this problem?

Eric Leichtenschlag

unread,
Jan 17, 2014, 8:33:33 PM1/17/14
to google-adm...@googlegroups.com
Hello,

The code written here is perfect, and from the StackOverflow post it looks like you've confirmed that you're getting ads in test mode. So that means the code is working correctly. The only thing I can think of is that the ad unit ID may be blacklisted if you had an Android or AdMob policy violation. If that happened, you would have already gotten an email by now, with steps on how to appeal. If that's not the case, I'd try creating a different ad unit ID and trying that out.

Thanks,
Eric
Reply all
Reply to author
Forward
0 new messages