iDecode
iDecode

Reputation: 29016

"No ad config" error onAdFailedToLoad even with test ad unit

Android (Java) way:

Minimal reproducible code:

public class MainActivity extends Activity {
    private static final String TAG = "MyTag";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        MobileAds.initialize(this);
        AdRequest adRequest = new AdRequest.Builder().build();
        InterstitialAd.load(this, "ca-app-pub-3940256099942544/1033173712", adRequest,
                new InterstitialAdLoadCallback() {
                    @Override
                    public void onAdLoaded(@NonNull InterstitialAd interstitialAd) {
                        Log.i(TAG, "onAdLoaded");
                        interstitialAd.show(MainActivity.this);
                    }

                    @Override
                    public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) {
                        Log.i(TAG, loadAdError.getMessage());
                    }
                });
    }
}

My build.gradle(app)

implementation 'com.google.android.gms:play-services-ads:20.2.0'

My AndroidManifest.xml:

<meta-data
    android:name="com.google.android.gms.ads.APPLICATION_ID"
    android:value="ca-app-pub-3940256099942544~3347511713"/>

Problem (on Android):

Even using the test Ad ID and test App ID, the ads are not loading up.


Flutter (Dart) way:

Minimal reproducible code:

void main() {
  WidgetsFlutterBinding.ensureInitialized();
  MobileAds.instance.initialize();
  runApp(MaterialApp(home: MyApp()));
}

class MyApp extends StatefulWidget {
  @override
  MyAppState createState() => MyAppState();
}

class MyAppState extends State<MyApp> {
  @override
  void initState() {
    super.initState();
    InterstitialAd.load(
      adUnitId: 'ca-app-pub-3940256099942544/1033173712',
      request: AdRequest(),
      adLoadCallback: InterstitialAdLoadCallback(
        onAdLoaded: (ad) => ad.show(),
        onAdFailedToLoad: (e) => print('Failed: $e'),
      ),
    );
  }

  @override
  Widget build(BuildContext context) => Container();
}

Problem (on Flutter):

The test ads show up but when I try to use my own Ad ID and App ID (even in the release mode), it fails with this error.

No ad config.

It's been a week now since I created that ad unit on Admob. I also have a different app on the Play Store (which is showing ad) but even if I use that app's ID in my code, it fails to load the ad with error code 3.

PS: Tried this solution already but it didn't work.

Either of Android or Flutter solution would work for me

Upvotes: 4

Views: 1449

Answers (4)

Sergio Bernal
Sergio Bernal

Reputation: 2327

Had a similar issue before, sometimes there are no ads for the size you are requesting. Try using different ad sizes to check if any ad is coming.

Upvotes: 0

Ole Pannier
Ole Pannier

Reputation: 3713

Error Code 3 : ERROR_CODE_NO_FILL

The ad request was successful, but no ad was returned due to a lack of ad inventory.

Why is it Happening: Advertisers can target specific regions, platforms, and user profiles based on business relevance, which can sometimes result in lower availability of Ads for a particular region or user profile. Error code suggests that the implementation is correct and that the Ad Request was not filled because of lack of availability of a suitable Ad at that particular instant of time when an Ad Request was sent from the app.

Policy-related restrictions on certain Apps or Ad Units will also lead to Error Code 3 being returned in response to Ad Requests.


How can this be solved?

→ As we cannot manipulate advertiser demand, there are no particular ‘fixes’ for this error.

→ Mediation: In some instances, certain Ad Networks may have limited performance in some regions or for specific formats, in which case the pubs can try using mediation to add other Ad Networks that may potentially perform well.

→ Check for Policy status for the Pub ID, the App, and the Ad Unit ID. Also, check the Brand Safety flags and Coppa status.

→ If the Pub can obtain Test Ads for an Ad Unit (Instructions) - then their implementation is correct, and the Ad Units will serve Ads normally when an Ad is available depending on advertiser demand.


Conclusion

Try to test your implementation with the above "Instructions" to make sure everything is set up correctly. But my personal opinion is, that it isn't set up wrong.

Error code suggests that the implementation is correct

I think my answer will help you to exclude some assumptions. And hopefully leads you to the final "fix".

Upvotes: 0

Zahid Tekbaş
Zahid Tekbaş

Reputation: 951

As I remember, after loading an Ad object, you need to show it to the user so the device can know when to show Ad based on condition or event, etc.

To load an Ad :

InterstitialAd.load(
  adUnitId: '<ad unit id>',
  request: AdRequest(),
  adLoadCallback: InterstitialAdLoadCallback(
    onAdLoaded: (InterstitialAd ad) {
      // Keep a reference to the ad so you can show it later.
      this._interstitialAd = ad;
    },
    onAdFailedToLoad: (LoadAdError error) {
      print('InterstitialAd failed to load: $error');
    },
  ));

Ad events to listen to the Ad status :


interstitialAd.fullScreenContentCallback = FullScreenContentCallback(
  onAdShowedFullScreenContent: (InterstitialAd ad) =>
     print('$ad onAdShowedFullScreenContent.'),
  onAdDismissedFullScreenContent: (InterstitialAd ad) {
    print('$ad onAdDismissedFullScreenContent.');
    ad.dispose();
  },
  onAdFailedToShowFullScreenContent: (InterstitialAd ad, AdError error) {
    print('$ad onAdFailedToShowFullScreenContent: $error');
    ad.dispose();
  },
  onAdImpression: (InterstitialAd ad) => print('$ad impression occurred.'),
);

To display an Ad :


myInterstitial.show();

As I see in your code, you did not show an Interstitial Ad in your UI code. Correct me if I'm wrong.

EDIT:

If you ask how to use it myInterstitial.show(); in your code, you can use it inside a FlatButton, TextButton, GestureDetector etc. and inside onTap or onPressed functions, use myInterstitial.show();

Upvotes: 1

Swaminathan V
Swaminathan V

Reputation: 4781

Let me provide some suggestions in a Generic way. Since you have mentioned

TEST Ads are working fine in Flutter way

I feel there is no major issue in the coding part. But I think there are some policies that you need to aware of when using Google Ads.

Invalid clicks and impressions & Invalid traffic

Invalid traffic includes any clicks or impressions that may artificially inflate an advertiser's costs or a publisher's earnings. Invalid traffic covers intentionally fraudulent traffic as well as accidental clicks.

So due to this, sometimes ads served to your app will be limited and this may be the reason for the issue. This can only be solved, by contacting the Google Support team.

And also you can check the email linked to your Google Ad account for any notification related to this. Usually, Google will be sending the email like below if policies do not adhere.

Google Ads serving limit placed on your account enter image description here

Make sure you comply with the list of policies mentioned in their site.

Upvotes: 0

Related Questions