问题
I've integrated admob Banner & Interstitial in my app. I've noticed that some of ads banner are fail to load. I've debug error code when ads fail to load, Error code is common Error : 3 It mean No fill error.
I've added banner and Interstitial ads in 3-4 screens.
Now Issues is that just one screen banner id is running and all Interstitial are working fine but some of banner not working. (in notch screen).
When I've change all screens banner id with same which was running proper and all screens working fine for notch screen also.
I've tested this case in nougat, oreo, marshmello etc. Normal Screen and notch screen.
I just notice that some of devices running with notch screen are not load all ads. But all normal screens are working fine. So I can't getting exact issue.
Note: All devices are running with same wifi network when I am testing.
I don't know if any thing is wrong with other unit id. But all unit id have same settings in my admob account. As per my testing case something is wrong with my AdUnit id. But can't getting what's the issue is.
I noticed one more case. If I added Testing id in request then it also working. I got device hash from android log.
I/Ads: Use AdRequest.Builder.addTestDevice("XXXXXXXXXX") to get test ads on this device.
.addTestDevice("XXXXXXXXXX")
If any extra debugging technique there it admob account then please share with me so I can check in detail.
Can any please help me to check this issue in detail? Please comment if any one need more explanation.
回答1:
public static final int ERROR_CODE_NO_FILL
The ad request was successful, but no ad was returned due to lack of ad inventory.
Constant Value: 3
Source: documentation https://developers.google.com/android/reference/com/google/android/gms/ads/AdRequest#ERROR_CODE_NO_FILL
There is nothing wrong with your code , the issue is admob doesnt always have Ad to return for your request possible reasons could be
-you have just registered your publisher id as it takes some time to start serving ads
-you have filtered some ads
回答2:
I've tried combination of devices running with different OS. Finally I got solution. I wrote this code when app was fail with error code 3 (No Fill Error)
<com.google.android.gms.ads.AdView
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
ads:adSize="SMART_BANNER"
ads:adUnitId="XXXXXXXXXXXXXXXX>
</com.google.android.gms.ads.AdView>
Now As per google sample code I've to use width with match_parent so I've changed width with match_parent still same error occurred. So finally I've change Size type with BANNER and now it run in all devices. (Google's demo code use BANNER type) I just tried this size and now all devices run ads banner. Not sure but as per my testing scenario ad was fail which device have large resolution (More than 16:9 ratio like 19:9 ratio 1080 x 2280 pixels) and After Set Banner size type as BANNER works fine with large resolution also.
回答3:
Check And Make sure You Have not linked two accounts to adsense as I have mistakenly done in my case.
if you are just creating your admob account waut for 24 hours and try again
share edit delete flag
回答4:
I was receiving the exact same message. The problem was that I was using a wrong test ad unit ID. The correct one is
ca-app-pub-3940256099942544/6300978111
source: https://developers.google.com/admob/android/banner
来源:https://stackoverflow.com/questions/53339695/admob-banner-ads-fail-to-load-error-code-3-no-fill