"No Ad Config." on onAdFailedToLoad() Method While trying to Load Ads
Asked Answered
R

12

49

I am trying to load interstitial advertisements for my app. Whenever I try to load these ads I get a Error saying "No Ads Config" from Domain "com.google.android.gms.ads".

Here is the code:

My AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.ayush.torch">


    <application

        android:allowBackup="true"
        android:icon="@drawable/ic_ico"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".main">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
        <meta-data
            android:name="com.google.android.gms.ads.APPLICATION_ID"
            android:value="i_have_put_my_app_id_here"/>
     
    </application>

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.FLASHLIGHT" />

</manifest>

onCreate() in main.java

        
        // Creating the InterstitialAd and setting the adUnitId.
        interstitialAd = new InterstitialAd(this);
        interstitialAd.setAdUnitId("i have also put my interstitial ad id here");


       interstitialAd.setAdListener(new AdListener() {
           @Override
           public void onAdLoaded() {
               Toast.makeText(main.this, "Ad Loaded", Toast.LENGTH_SHORT).show();
           }

           @Override
           public void onAdFailedToLoad(LoadAdError loadAdError) {
               String error = String.format("domain: %s, code: %d, message: %s", loadAdError.getDomain(), loadAdError.getCode(), loadAdError.getMessage());
               Toast.makeText(main.this, "onAdFailedToLoad() with error: " + error, Toast.LENGTH_SHORT).show();
           }
       });

When I load my ad in a on function it gives me error "No Ad Config."

                    Log.d("[Ads]","Ad Load State For on(): " + interstitialAd.isLoaded());
                    if (interstitialAd.isLoaded()) 
                    {
                        interstitialAd.show();
                    }
Rica answered 10/10, 2020 at 23:26 Comment(0)
R
47

Fixed It and it works.

Found a resource from google. And It cleared all my doubts. For Test Ad Resource Click Me

The Advertisement works in two ways.

  1. While The App Is In Development.
  2. While The App Is In Production.

Scenario 1: While the App Is In Devlopment

For this case, we need to use Test Advertisements. Admob and "com.google.android.gms.ads" doesnt allow user to use Advertisements in Development Phase due to false impressions.

To enable Test Advertisement. There are two ways: You can either use google ad unit id's which are available on the link adove. Or You can use your own ad unit id, but you will be needing to register your device as a test device and use your own request configuration. Here is a simple Example: Search for your "Device Id" In "Logcat"

It will look something like

I/ADS: Use Requested Configuration......Arrays.asList("Your device Id will be here");

Then Just Copy Paste This(i can read your mind..)

// Change your Id
RequestConfiguration configuration = new RequestConfiguration.Builder().setTestDeviceIds(Arrays.asList("your device id should go here")).build();
MobileAds.setRequestConfiguration(configuration);

Now just load the ad and it will pop up. Congratz. :)


Scenario 2: While the App Is In Production

This is pretty simple part...

  1. Just remove the .setTestDeviceIds(Arrays.asList("your device id should go here")) part from the code...
  2. Link your AdMob App to PlayStore. [Is your app published? Yes...yes...and on...]
  3. Just opt for ad.
  4. And check if Ads are enabled in your app settings on play console.
  5. It should work now. Congratz.
Rica answered 12/10, 2020 at 4:16 Comment(10)
@MushfiqulTuhin Not a problem πŸ‘. – Rica
Does this works only when it published to playstore?Or in signed apk also live ads display? Thanks. – Margit
@ManikumarGouni It only works when app is published to Play Store to prevent false impressions. – Rica
Doesn't solve the problem for rewarded ads. Still getting no ad config error. – Heim
@Heim Try Looking In This Article developers.google.com/admob/android/rewarded – Rica
Solved my problem, thanks! I had my device setup as test device on the AdMob webpage and was also trying to show the TestAdIds from the tutorial. That resulted in a config error. I now use my "real/own" ad unit Ids and it works great and only shows me test Ads on my configured Test devices. – Luminal
@Luminal I am really glad it helped you. Have a great day. – Rica
This is the answer i was looking for Thanks Buddy – Slugabed
Used the production (unitId + appId) and test device (programmatic) combination and it worked. ΰ€§ΰ€¨ΰ₯ΰ€―ΰ€΅ΰ€Ύΰ€¦!!! – Knee
Doesn't solve the problem for rewarded ads. Still getting no ad config error. – Trilobite
L
16

My mistake: Setting test devices and loading test ads at the same time

Solution: Use one only. By using the test devices with production ad unit id's the error disappeared. Ads are loading again and they are test ads even if you specify the production ad unit id

Leak answered 14/9, 2021 at 14:12 Comment(1)
If you set up an app-ads.txt file for your app, you need to also include this line in your app-ads.txt file in order to load ads using the demo ad units: "google.com, pub-3940256099942544, DIRECT, f08c47fec0942fa0" source: developers.google.com/admob/android/test-ads#sample_ad_units – Boulder
H
10

This is another method which doesnt require programming.

Go to Admob dashboard > Settings > Test device > Add test device

To find this go to your device settings > Google > Ads > in that you can find your advertising id!

Hardboard answered 15/7, 2021 at 13:48 Comment(1)
It's the best and simple solution which I've after searching for about 20mins. Thanks @Harsh Kothari – Gujral
A
7

This also could happen if your app is uploaded to some store and you didn't set your app-ads.txt correctly.

You should bear in mind that if you are using AdMob test ads, you should add this entry into your app-ads.txt too:

google.com, pub-3940256099942544, DIRECT, f08c47fec0942fa0

Soure: https://developers.google.com/admob/android/test-ads

Armyn answered 19/10, 2021 at 21:18 Comment(0)
H
4

For FLUTTER apps, using google_mobile_ads there is a slight difference in setting test device. According to documentation you have to updateRequestConfiguration. Sample code below:

MobileAds.instance.updateRequestConfiguration(RequestConfiguration(testDeviceIds: ["yourdeviceId"]));

You can get the test device by searching for RequestConfiguration in the run output logs.

Headlong answered 19/10, 2021 at 8:35 Comment(0)
M
2

For Live PlayStore App Check if Ads are enabled in your app settings on the play console.

Macerate answered 2/9, 2022 at 18:4 Comment(0)
K
1

For me, This happens in a development phase, I am using .aab not .apk which Google will re-sign it using their Keystore, hence using my own Keystore will return "Error Code 3, No Ads Config".

Krigsman answered 17/4, 2022 at 2:12 Comment(1)
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center. – Histiocyte
J
0

I am using flutter. I just added my device in Admob test devices and it worked. In production I will only remove the test device.

Let me know if I am wrong.

Jilly answered 29/5, 2021 at 12:13 Comment(3)
Good, Remember to enable the advertisements when publishing the apps on Play Console. – Rica
Sure, I will do that. – Jilly
can you share the code? – Mononuclear
B
0

In my case I forgot to change the app ID for ironsource after I switched from iOS to Android so it kept calling the iOS version of ironsource which was configured to call the wrong Admob ad unit IDs. After fixing the ironsource ID, the correct Admob unit IDs were called and the error was fixed.

Bridgeport answered 4/1, 2022 at 4:0 Comment(0)
E
0

Recently , i face same issue, resolved this problem.

Step1 - Please check your test ads running. Step2 - Signin your app with your .jks file(which is previously used in old version of your app).

Thanks

Elf answered 1/8, 2022 at 3:23 Comment(0)
W
0

My app was already in production and I wanted to add ads in a new update and I faced the same problem. The solution if anyone is having the same issue is to load a test ad unit id instead of your production ad unit id. Once the app is ready and tested, simply replace the test ad unit id with your production one before publishing the app bundle to Google Play console.

Weisbrodt answered 5/12, 2022 at 2:59 Comment(0)
C
-10

This warning is nothing more than a sign that your AdMob Account has not yet received a bank confirmation or bank account addition confirmation.

Caulis answered 12/5, 2021 at 10:45 Comment(2)
Wrong, I received a notice that my bank information has been checked and my Admob account is ready to use. – Acanthus
this has nothing to do with the actual problem that has mentioned above. – Novick

© 2022 - 2024 β€” McMap. All rights reserved.