Admob No fill from ad server - failed to load ad: 3
Asked Answered
T

18

37

My issue is that ads are not being displayed at all in my app, test mode or not. I am going to keep this question specific to test mode, and once I get that working I will worry about live ads.

Development Information

I am using Eclipse for development.

I have setup ads using Google Play Services and Admob in my Android app, as described in the online documentation provided by Google.

I have added my device ID using addTestDevice("xxxxxxxxxxxxxxxx"), and have checked the hashed device ID a number of times to be sure it is correct.

The Issue (see below for log info)

When I run the application on my device, no ads are displayed at all. This happens even when I have added my device as a test device.

I have searched high and low, and turned up many similar issues, but am yet to find an answer to this specific problem.

LogCat Output

10-28 13:56:41.659: I/Ads(1704): Starting ad request.
10-28 13:56:42.187: I/Ads(1704): No fill from ad server.
10-28 13:56:42.187: W/Ads(1704): Failed to load ad: 3
10-28 13:56:42.199: W/Ads(1704): No GMSG handler found for GMSG: gmsg://mobileads.google.com/jsLoaded?google.afma.Notify_dt=1414504602197

My Activity

   package bb.hoppingbird;

    import org.cocos2d.layers.CCScene;
    import org.cocos2d.nodes.CCDirector;
    import org.cocos2d.opengl.CCGLSurfaceView;

    import com.google.android.gms.ads.AdListener;
    import com.google.android.gms.ads.AdRequest;
    import com.google.android.gms.ads.AdSize;
    import com.google.android.gms.ads.AdView;
    import com.google.android.gms.ads.InterstitialAd;

    import android.app.Activity;
    import android.content.SharedPreferences;
    import android.media.MediaPlayer;
    import android.os.Bundle;
    import android.support.v4.view.ViewPager.LayoutParams;
    import android.util.DisplayMetrics;
    import android.view.KeyEvent;
    import android.widget.RelativeLayout;
    import android.widget.Toast;

    public class MainActivity extends Activity {

    private CCGLSurfaceView mGLSurfaceView;

    //<!-- Admob Ads Using Google Play Services SDK -->
    private static final String AD_UNIT_ID = "ca-app-pub-xxxxxxxxxxxxxxxxxxxx";
    private static final String AD_INTERSTITIAL_UNIT_ID = "ca-app-pub-xxxxxxxxxxxxxxxxxxxx";


    /** The Admob ad. */
    private InterstitialAd interstitialAd = null;
    public AdView adView = null;

    public static MainActivity app;

    public void onCreate(Bundle savedInstanceState)
    {
        app = this;

        super.onCreate(savedInstanceState);

        // set view
        mGLSurfaceView = new CCGLSurfaceView(this);


        //Ads ----------------
        // Create the adView
        RelativeLayout layout = new RelativeLayout(this);
        layout.setLayoutParams(new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));

        //<!-- Ads Using Google Play Services SDK -->
        adView = new AdView(this);
        adView.setAdSize(AdSize.SMART_BANNER);
        adView.setAdUnitId(AD_UNIT_ID);

        // Add the adView to it
        RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(
                LayoutParams.WRAP_CONTENT,
                LayoutParams.WRAP_CONTENT);
        params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE);
        params.addRule(RelativeLayout.CENTER_HORIZONTAL, RelativeLayout.TRUE);

        adView.setLayoutParams(params);

        layout.addView(mGLSurfaceView);
        layout.addView(adView);

        setContentView(layout);
        //New AdRequest 
        AdRequest adRequest = new AdRequest.Builder()
        .addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
        .addTestDevice("0D47C6944503F0284666D16BB79BF684")
        .build();

    // Start loading the ad in the background.
    adView.loadAd(adRequest);


        //-----------------------------------------------------Interstitial Add
        // Create an Interstitial ad.
        interstitialAd = new InterstitialAd(this);
        interstitialAd.setAdUnitId(AD_INTERSTITIAL_UNIT_ID);
        interstitialAd.setAdListener(new AdListener() {
              @Override
              public void onAdLoaded() {
                interstitialAd.show();
              }

              @Override
              public void onAdFailedToLoad(int errorCode) {
                  Toast.makeText(getApplicationContext(), "Interstitial Ads loading failed", Toast.LENGTH_SHORT).show();
              }
        });
         // Load the interstitial ad.
        //showInterstitialAds();

        //----------------------
        // set director
        CCDirector director = CCDirector.sharedDirector();
        director.attachInView(mGLSurfaceView);
        director.setAnimationInterval(1/60);

        // get display info
        DisplayMetrics displayMetrics = new DisplayMetrics();
        getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
        G.display_w = displayMetrics.widthPixels;
        G.display_h = displayMetrics.heightPixels;
        G.scale = Math.max(G.display_w/1280.0f, G.display_h/800.0f);
        G.width = G.display_w / G.scale;
        G.height = G.display_h / G.scale;

        // get data
        SharedPreferences sp = CCDirector.sharedDirector().getActivity().getSharedPreferences("GameInfo", 0);
        G.music = sp.getBoolean("music", true);
        G.sound = sp.getBoolean("sound", true);

        // create sound
        G.soundMenu = MediaPlayer.create(this, R.raw.menu);
        G.soundMenu.setLooping(true);
        G.soundGame = MediaPlayer.create(this, R.raw.game);
        G.soundGame.setLooping(true);
        G.soundCollide = MediaPlayer.create(this, R.raw.collide);
        G.soundJump = MediaPlayer.create(this, R.raw.jump);
        G.soundLongJump = MediaPlayer.create(this, R.raw.long_jump);
        G.soundSpeedDown = MediaPlayer.create(this, R.raw.speed_down);
        G.soundSpeedUp = MediaPlayer.create(this, R.raw.speed_up);
        G.soundDirection = MediaPlayer.create(this, R.raw.direction_sign);
        G.soundClick = MediaPlayer.create(this, R.raw.menu_click);
        G.soundCollect = MediaPlayer.create(this, R.raw.collect);
        G.bgSound = G.soundMenu;

        // show menu
        CCScene scene = CCScene.node();
        scene.addChild(new MenuLayer(true));
        director.runWithScene(scene);
    }  

    @Override
    public void onPause()
    {
        if (adView != null) {
              adView.pause();
            }

        super.onPause();
        G.bgSound.pause();
        CCDirector.sharedDirector().onPause();
    }

    @Override
    public void onResume()
    {
        super.onResume();

        if (adView != null) {
            adView.resume();
          }

        if( G.music ) G.bgSound.start();

        CCDirector.sharedDirector().onResume();
    }

    @Override
    public void onDestroy()
    {
        // Destroy the AdView.
        if (adView != null) {
          adView.destroy();
        }

        super.onDestroy();
        G.bgSound.pause();
        CCDirector.sharedDirector().end();
    }

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event)
    {
        if( keyCode == KeyEvent.KEYCODE_BACK )
        {
            CCDirector.sharedDirector().onKeyDown(event);
            return true;
        }
        return super.onKeyDown(keyCode, event);
    }

    public void showInterstitialAds()
    {
        runOnUiThread(new Runnable() {
            public void run() {
                 AdRequest interstitialAdRequest = new AdRequest.Builder().build();
                 interstitialAd.loadAd(interstitialAdRequest);
            }
        });
    }
}
Ted answered 28/10, 2014 at 14:6 Comment(5)
You shouldn't post AD_UNIT_ID and AD_INTERSTITIAL_UNIT_ID visibly on the internetHypophyge
Have you identified whether the banner or the interstitial fails? Or perhaps both? Also are you using the test AD_UNIT_ID that google provides in their tutorial?Pompey
Hi @TimCastelijns banner and interstital fails. thanksTed
What about the AD_UNIT_ID? Is it your own? Or Google's test ID? Also, do you have Google play available on your device?Pompey
Yes, i have google play in my device and AD_UNIT_ID is mineTed
B
13

If you create adunit and use it immediately may show this error, try to load ads after 30 minutes or more time.

Boston answered 16/4, 2015 at 8:57 Comment(1)
It may even take a few hours (with new ad units, or perhaps even a new AdMob app).Tympanum
P
11

The issues comes only if that particular app is suspended from playstore. Maybe you can try changing the package name and and also with new Admob Id.There is a chance that particular admob id can also be suspended due to compliances.

Pavla answered 9/11, 2014 at 16:29 Comment(6)
I agree with this answer, just rename your package, it will work 100%.Flagstaff
I just encountered this today. My app was suspended.. Change also the app name - <string name="app_name">TestApp</string>Verify
This is wrong. The reason might be that the app is suspended, but there are other possible reasons. For instance, creating another app unit in the admob interface might help.Elizebethelizondo
Unfortunately "The issues comes only if that particular app is suspended from playstore." is not true. My app and admob account are fine, in fact ~37% of customers are receiving ads. This was sudden, overnight, down from ~100% without even updating my app on the Google Play. My 2 test devices however are not displaying the ads and are getting the code 3 error also.Atalaya
my app not suspended still i am facing same issue. so i think suspended is not reason for this error.Seagirt
@JohnAshmore Same thing is happening with me, is there any work around for that ? How did you solve this ?Ennoble
N
7

You need to use ID that Google provide for you for current test device. You can find it in logcat, just find something like this:

Ads: Use AdRequest.Builder.addTestDevice("903A70A3D439E256BAED43E65A79928E") to get test ads on this device.
Noctambulism answered 20/12, 2017 at 15:20 Comment(0)
S
3

it's also possible to luck of inventory. I am also face because of of this. failed to load ad : 3

Seagirt answered 4/8, 2016 at 6:18 Comment(0)
K
3

In my case I found that my billing address was not verified and ads were blocked. Verify billing address it will automatically get fixed. https://www.google.com/adsense/

Kkt answered 23/1, 2018 at 11:26 Comment(1)
This looks like what is happening for me as well. The test ad units display. I had a previous app with this gmail address that never hit the payout threshold. I don't remember it being adsense, but maybe it was? The new one that I am currently using is admob, and those ads are reliably getting "failed to load code 3". At my adsense home page it says "Your ad units are not displaying because you haven't yet verified your address (PIN)." Going to try resending the PIN.Cruce
H
2

If your AdMob account is only configured for banner ads and you're using interstitial ads, you may get this problem. My 2 cents.

Headcheese answered 4/7, 2015 at 18:58 Comment(0)
S
2

Basically just try pass your test device id to adBuilder :

/** adRequest Object For test device */
AdRequest adRequest = new AdRequest.Builder().addTestDevice("TEST_DEVICE_ID").build();

/** adRequest Object For Production Device*/
AdRequest adRequest = new AdRequest.Builder().build();

You can find your test divece id in logCat after without test divece id adBuilder request:

I/Ads: Use AdRequest.Builder.addTestDevice("TEST_DEVICE_ID") to get test ads on this device.

Scherman answered 29/12, 2018 at 11:38 Comment(0)
D
1

If you app support Designed for Families.

Bundle extras = new Bundle();
extras.putBoolean("is_designed_for_families", true);

AdRequest request = new AdRequest.Builder()
        .addNetworkExtrasBundle(AdMobAdapter.class, extras)
        .build();
Dizen answered 6/8, 2015 at 3:37 Comment(3)
I created my banner ad and also verify my payment information, and after 2 days i test my ad and it gives me the error that Error code 3 No add fill from the server...Hymnody
@AsadMukhtar Hi, I am having the same issue, i created the banner ad and also have everything verified and after 2 days i am not getting ads(no ads not even test ads are showing). Same msg "Error code 3 No add fill from the server" could you please _/\_ HELP? What happened in your case?, how did you solve it? or was this temporary?Sublimity
Same issue, but noticed it only worked ok depending on device/screen orientation! Pixel 3 landscape OK, portrait KO. Then on Doogee, landscape KO, portrait OK !? Using smartbanner or banner makes very little difference.Papotto
D
1

I was testing on Galaxy S4, later my friend tested on Note 2 and it did not show the banner ad. Hence the problem was test device Id. If you are testing then make sure the test device ID is of the device you are testing on.

Dinin answered 12/12, 2015 at 15:27 Comment(0)
G
0

I had this problem too. It wasn't until I went to Admob.com and "manually" added my app so I could get my "Ad Unit Id". I put this Ad Unit Id string as the argument my adView.setAdUnitId call. Then I installed and opened the "release" APK I generated via Eclipse. File > Export > Export Android Application

Gaekwar answered 15/2, 2015 at 6:55 Comment(0)
P
0

I had this issue as well today. My app was not suspended, but the apk name change did work. We had renamed a test app to release it to production; we changed the apk name as a result. This screwed up our ad fill on both MoPub and Admob.

Pandarus answered 18/4, 2015 at 6:27 Comment(0)
D
0

Ads are disabled from Admob server, your code is ok, try to change the package name, and see if ads are displayed. Then contact admob to see the problem.

Diplopod answered 31/5, 2015 at 7:55 Comment(0)
A
0

In my case this was the error as result of requesting a geo-restricted ad from a region that's not supported for that ad. If I hardcoded the location for the ad request bundle to be inside the acceptable region, or not include a location in the request at all, the ad was rendered just fine; otherwise I had the same error as OP in console.

Avifauna answered 19/11, 2015 at 21:12 Comment(0)
O
0

In my case my banner ads have response code 3 on some devices with high API and especially with wide screen (I have used smart banner size), changing dependcy from com.google.android.gms.ads to com.google.firebase:firebase-ads (In case you are using Firebase) solved my problem.

Ossieossietzky answered 18/1, 2018 at 10:50 Comment(0)
C
0

In my case I was testing using an emulator and getting the same error. After change to a phone everything works.

Try another test device.

Code answered 16/5, 2018 at 21:58 Comment(1)
How to fix that on emulators?Throng
S
0

It might be because you're not waiting for the ad to load.

For me implementing the AdLoaded method of the AdListener did the job.

    mAdInterstitial.loadAd(AdRequest.Builder().addTestDevice("XXXXXXX").build())
    mAdInterstitial.adListener = object : AdListener() {
        override fun onAdLoaded() {
            mAdInterstitial.show()
        }
    }
Sunnisunnite answered 23/4, 2019 at 18:15 Comment(0)
D
0

I was following along a youtube tutorial and the guy was using a "Banner" at first and switched to "SMART_BANNER". So I thought I could also use the smart banner. Unfortunately this was the mistake, I changed the adsize and it worked. You also might have a different adSize.

 <com.google.android.gms.ads.AdView
        android:id="@+id/adView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        app:adSize="BANNER"
        app:adUnitId="ca-app-pub-3940256099942544/6300978111"></com.google.android.gms.ads.AdView>

Code used in the Activity:

MobileAds.initialize(this) {}
var mAdView = findViewById<AdView>(R.id.adView)

val adRequest = AdRequest.Builder().build()
mAdView.loadAd(adRequest)
Durkheim answered 11/1, 2021 at 3:59 Comment(0)
R
-4

try this:

MobileAds.initialize(this, getString(R.string.admob_app_id));
AdView mAdView = findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().build();      
mAdView.loadAd(adRequest);
Romeliaromelle answered 27/3, 2018 at 23:14 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.