77

I have followed many answers about that error here, but my problem is not solved. Every time I run my app no ads appear and I get this error message in Logcat:

"There was a problem getting an ad response. ErrorCode: 0 Failed to load ad:0"

Here is my java code. What did I miss?

private void LoadAds() {

 AdView mAdView = (AdView) findViewById(R.id.linearLayoutAdmob);

 AdRequest adRequest = new AdRequest.Builder().build();

 mAdView.loadAd(adRequest);

and here my xml layout with admob at the last lines

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
 xmlns:ads="http://schemas.android.com/apk/res-auto"
 xmlns:tools="http://schemas.android.com/tools"
 android:layout_width="fill_parent"
 android:layout_height="fill_parent"
 android:orientation="vertical"
 android:background="@drawable/background_play"
 tools:context=".MainActivity" >

<RelativeLayout
    android:id="@+id/rlayout1"
    android:layout_width="fill_parent"
    android:layout_height="0px" 
    android:padding="5dip"       
    android:layout_weight="2.3" >

    <com.aapps.find.TouchImage
        android:id="@+id/gameimage1"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:scaleType="fitXY"
        android:src="@drawable/ic_launcher" />

    <ImageView
        android:id="@+id/hitimage1"
        android:layout_width="50dp"
        android:layout_height="50dp"
        android:src="@drawable/hit"
        android:visibility="invisible" />

    <ImageView
        android:id="@+id/errorimage1"
        android:layout_width="30dp"
        android:layout_height="30dp"
        android:src="@drawable/miss1"
        android:visibility="invisible" />
</RelativeLayout>
<RelativeLayout
    android:id="@+id/rlayoutprogress"
    android:layout_width="fill_parent"
    android:layout_height="0px"
    android:layout_weight="0.1" >
   <com.aapps.find.utility.SaundProgressBar
    android:id="@+id/progressBar"
    style="@style/Widget.ProgressBar.RegularProgressBar"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"/>
   </RelativeLayout>
   <RelativeLayout
    android:id="@+id/rlayout2"
    android:padding="5dip"  
    android:layout_width="fill_parent"
    android:layout_height="0px"
    android:layout_weight="2.3" >
   <com.aapps.find.TouchImage
        android:id="@+id/gameimage2"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:scaleType="fitXY"
        android:src="@drawable/ic_launcher" />

    <ImageView
        android:id="@+id/hitimage2"
        android:layout_width="50dp"
        android:layout_height="50dp"
        android:src="@drawable/hit"
        android:visibility="invisible" />

    <ImageView
        android:id="@+id/errorimage2"
        android:layout_width="30dp"
        android:layout_height="30dp"
        android:src="@drawable/miss1"
        android:visibility="invisible" />
</RelativeLayout>
<RelativeLayout
    android:id="@+id/rlstatus"
    android:layout_width="fill_parent"
    android:layout_height="0px"
    android:layout_weight="0.3" >
    <TextView
        android:id="@+id/scoreCount"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:layout_marginLeft="15dp"
        android:textSize="16sp"
        android:textStyle="bold"
        android:textColor="#fffd7a"
        android:layout_centerVertical="true"
        android:layout_centerHorizontal="true"
        android:layout_alignParentLeft="true"/>

    <TextView
        android:id="@+id/hitCount"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:textSize="16sp"
        android:textStyle="bold"
        android:textColor="#fffd7a"
        android:layout_centerVertical="true"
        android:layout_centerHorizontal="true"
        android:layout_marginLeft="15dp"
        android:layout_toRightOf="@id/scoreCount"/>

    <ImageView
        android:id="@+id/imgSound"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:layout_alignParentRight="true"
        android:layout_marginRight="15dp"
        android:src="@drawable/sound" />
    <ImageView
        android:id="@+id/imgHint"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:layout_marginRight="15dp"
        android:layout_toLeftOf="@id/imgSound"
        android:src="@drawable/hint" />
    <TextView
        android:id="@+id/hintCount"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:layout_marginRight="26dp"
        android:textSize="16sp"
        android:textStyle="bold"
        android:layout_centerVertical="true"
        android:layout_centerHorizontal="true"
        android:layout_toLeftOf="@id/imgSound"/>
</RelativeLayout>


      <com.google.android.gms.ads.AdView
    android:id="@+id/linearLayoutAdmob"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_alignParentBottom="true"
    ads:adSize="BANNER"
    ads:adUnitId="@string/admob_id">
</com.google.android.gms.ads.AdView>
</LinearLayout>

I cannot figure what the problem is. I'm new in android development.

Jared Rummler
  • 37,824
  • 19
  • 133
  • 148
Ahmed Samir
  • 791
  • 1
  • 5
  • 8

20 Answers20

84

This is what google says

"It could be that you have only recently created a new Ad Unit ID and requesting for live ads. It could take a few hours for ads to start getting served if that is that case. If you are receiving test ads then your implementation is fine. Just wait a few hours and see if you are able to receive live ads then. If not, can send us your Ad Unit ID for us to look into."

so basically you have to wait for a few hours :)

https://groups.google.com/forum/#!category-topic/google-admob-ads-sdk/android/fBe3YL3ffpo

Gueorgui Obregon
  • 5,077
  • 3
  • 33
  • 57
zooter
  • 2,128
  • 1
  • 13
  • 23
  • 8
    how much time it will to take live?? – Arpit Patel Nov 20 '16 at 08:52
  • Adding the test device ID, solved my problem. my Ad unit had just being created..thx – Victor Lee Apr 06 '17 at 02:55
  • I have been waiting for nine hours. Also I checked the codes many and many times and it seems correct. It shows test advertisings in test device. but it is still not working in release. Is there any thing that I can do ? – Olkunmustafa Jul 18 '17 at 19:51
  • 2 weeks ago I created – user25 May 13 '18 at 09:55
  • it works ok for one phone (with 6.1 Android), but fails for another (with 4.4.4 Android), so it just can be a bug in AdMob SDK https://groups.google.com/forum/#!category-topic/google-admob-ads-sdk/android/c3tmDhX0g7M – user25 May 13 '18 at 09:56
17

If you are using live admob ads id in development mode application , it will show this error.

Use debug mode admob ads id during development and live admob ids in release mode app

Sourabh soni
  • 488
  • 7
  • 11
17

Solution:

  1. If your account is new, that might be the problem. Wait 2-3 hours, after that it will automatically start showing ads.
  2. If it still doesn't show ads, maybe you forgot to setup a payment method.

How to setup payment methods in AdMob:

  • Login into AdMob
  • Navigate to "Payments" tab on the left side of your screen
  • Type in your real address, name and account type
  • Put the ads (ad unit) into the application
  • Wait for 2-3 Hours
  • There you go!

If you are still experiencing problems, feel free to contact me via email: ashkaushik0007@gmail.com

Community
  • 1
  • 1
Aashish Kaushik
  • 450
  • 4
  • 17
15

If you have just opened your admob account, Fill the payment details first, else you will not get the ad impression even in the test mode.

NBA group
  • 149
  • 1
  • 5
  • I had fill the payment methods but the ads still do not show. I created ad unit id 2 days ago. Do you have any suggestion? – Son Truong Sep 30 '18 at 16:18
  • You can use test ad unit id provided by the google. If it works, then your code is proper to show the ads. – NBA group Oct 20 '18 at 11:01
  • Adding the payment details fixed my issue. Can't believe I wasted 2 nights for this. – NewestStackOverflowUser Sep 28 '19 at 15:19
  • This was the case for me as well. My test ads started after setting this up and within a few hours, receiving a mail from admob team that my account is now verified. – crazydiv Mar 18 '21 at 07:05
7

You have to verify the size of the ad you created, if it is smaller it will always get this error. Just verify and change to the specific size:

  ads:adSize="360x100"
user3394003
  • 119
  • 1
  • 2
4

Open your adMob account and create new sets of keys,and put this keys(banner/interstitial)in your project.this is happens to me once i fixed like this,try this solution. or still issues create new app (just change the name) in adMob and create new keys

Jithu P.S
  • 1,843
  • 1
  • 19
  • 32
4

Make sure you don't have an add blocker installed on your device.

Goran Horia Mihail
  • 3,536
  • 2
  • 29
  • 40
4

Make sure you've added this in the AndroidManifest.xml file

<meta-data
            android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version" />
AnupamChugh
  • 1,779
  • 1
  • 25
  • 36
3

I was getting this error because admob has blocked my app to serve ads. So I changed the package name and everything started to work perfectly fine

Zohab Ali
  • 8,426
  • 4
  • 55
  • 63
3

I added the code below for the testing environment

 AdRequest adRequest = new AdRequest.Builder().addTestDevice(your device id)
 //When you testing on emulator
.addTestDevice(AdRequest.DEVICE_ID_EMULATOR).build();
Madasamy
  • 67
  • 7
3

May not apply to all, but my personal problem was turning off my Pi-hole

And yes for those wondering, I like to regularly shoot myself in the foot.

Pants
  • 669
  • 7
  • 24
2

try changing ads:adSize="BANNER" with ads:adSize="SMART_BANNER"

Gjoko Bozhinov
  • 1,137
  • 11
  • 15
  • thanks for reply i tried it and still the problem no ads error 0 – Ahmed Samir Aug 12 '15 at 19:05
  • Than maybe you have problem with java code. Do you call LoadAds only 1 time, and do you call it in onCreate? – Gjoko Bozhinov Aug 12 '15 at 19:14
  • yes i only call it one time onCreate and still no ads – Ahmed Samir Aug 12 '15 at 19:20
  • 1
    W/Ads: Received error HTTP response code: 403 Ads: There was a problem getting an ad response. ErrorCode: 0 Ads: Failed to load ad: 0 – Harsha Mar 14 '17 at 06:03
  • please help me suddenly ads not coming from play store app.am not getting any notifications issue also.while add test device id for test ads coming those test ads.impressions also 0 for live ads – Harsha Mar 14 '17 at 06:04
2

i found the error from the emulator after i install the app on real device the ads shown perfectly thanks everyone and i hope my answer being useful for others ..

Ahmed Samir
  • 791
  • 1
  • 5
  • 8
2

One more reason can be: Missing payment information

Your ad units aren't serving ads because your payment information is missing. Add your payment information now. Learn More

Deven
  • 3,078
  • 1
  • 32
  • 34
0

If your ad unit id string is like this: xyz You should remove the translatable part. For me it fixed the problem.

Atinator98
  • 51
  • 1
  • 7
0

Most likely you have recently created a new Ad Unit ID, but you also could get this error because you're passing a wrong Ad Unit ID.

maabed sj
  • 1
  • 1
0

Make sure your ads not violate Google Ads rule, otherwise you have to fill appeal form first to contact AdMob support and after they re-enable your ads serving, ads should appear.

Yao Li
  • 2,071
  • 1
  • 25
  • 24
0

Dear Friend if after then you start to using your real ADMOB app ID instead of testing ids , just wait a few hours(for me it takes about 2-3 hours) after which you will get live admob ads.

Petros Mosoyan
  • 238
  • 2
  • 15
0

If you have just implemented ads and want to test it only and still not getting ads seen then use this test ads ids Sample Ads Ids

One more thing, if you are testing it in emulator then use this in Kotlin

val adRequest = AdRequest.Builder()
                .addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
                .build()

Also go through this

Kishan Solanki
  • 13,761
  • 4
  • 85
  • 82
0

In my case, It worked on switching to another internet connection. Earlier I was using my company's wifi and changing the connection to my personal wifi hotspot it worked!

Pinkesh Darji
  • 1,041
  • 10
  • 23