Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NativeExpressAdView - Failed to load ad: 0 #27

Closed
nthuat opened this issue Jun 15, 2016 · 7 comments
Closed

NativeExpressAdView - Failed to load ad: 0 #27

nthuat opened this issue Jun 15, 2016 · 7 comments

Comments

@nthuat
Copy link

nthuat commented Jun 15, 2016

I use NativeExpressAdView but I can't get ad within this warning:

06-15 09:47:32.557 13810-14512/com.bangdev.wifichua W/Ads: There was a problem getting an ad response. ErrorCode: 0 06-15 09:47:32.557 13810-13810/com.bangdev.wifichua W/Ads: Failed to load ad: 0

This is my ad layout:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:ads="http://schemas.android.com/apk/res-auto"
              xmlns:android="http://schemas.android.com/apk/res/android"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:orientation="vertical">

    <com.google.android.gms.ads.NativeExpressAdView
        android:id="@+id/adView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        ads:adSize="SMART_BANNER"
        ads:adUnitId="ca-app-pub-4793975677981221/2700177593"/>
</LinearLayout>

Load ad in my code:

final NativeExpressAdView adView = (NativeExpressAdView) view.findViewById(R.id.adView); adView.loadAd(new AdRequest.Builder().build());

Google play service version: 9.0.2

@longbkiter07
Copy link

I got this issue as well.

@ericleich
Copy link
Member

With Native Ads Express, your NativeExpressAdView size needs to fit in the range of sizes you picked in the AdMob Front-end. In this case, Smart banner is not big enough.

See the Choosing a Size section in the docs for what the ranges are for the Native Ads Express templates. Now see how the sizing of Smart Banners works, since you chose SMART_BANNER as your size.

Let's say you're running this app on a Nexus 5 in portrait. The smart banner will be sized at 360x50. When you compare that against the requirements for the Native Ads Express templates, you'll see that even the Small template requires a height of 80dp. Because your size doesn't fit the requirements, you won't ever see an ad.

Try changing the size to ads:adSize="300x250". That size fits all 3 templates, and so you should get an ad back. I just tested it myself and it worked for your ad unit. For more precise measurements, double check which size you picked on the AdMob front-end, and make sure the width and height of your ad fits within the ranges.

We'll investigate more internally why the error code indicates internal error. This could be surfaced a bit better. However, I'm going to close this issue though for the reasons mentioned above.

@nthuat
Copy link
Author

nthuat commented Jun 23, 2016

Thanks @ericleich for replying. I think Admob should show warnings about this case to help everyone can reproduce the mistakes.

@ericleich
Copy link
Member

Yep, I'm following up internally to see what can be done on that front.

@ajay29592
Copy link

i check every thing . it running in other demo app but when i initiate it programmatic it not run in my app.

@ericleich
Copy link
Member

What size are you giving the NativeExpressAdView, and what size template are you using in the AdMob UI?

@kmansoft
Copy link

kmansoft commented Jul 1, 2017

Re: Try changing the size to ads:adSize="300x250".

Is there a list of supported ad sizes somewhere?

Is it true (seems to be) that the "test unit id" suggested in the documentation -- "ca-app-pub-3940256099942544/2177258514" -- only supports the larger sizes (e.g. 300x250, 360x320)?

If so (about the test unit id), then there is no good way to test "small" sized native ads -- since developers are not supposed to not only click on ads, but also even display them on their own devices?

Re: We'll investigate more internally why the error code indicates internal error.

Still getting this in firebase-ads:11.0.1 - comes back with "Error 0", which does not seem helpful.

Any chance for a proper error message?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants