Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

admob getting an ad response. ErrorCode: 0 Failed to load ad:0

Tags:

android

admob

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.

like image 732
Ahmed Samir Avatar asked Aug 12 '15 18:08

Ahmed Samir


People also ask

Why is my AdMob app not showing ads?

Ads won't show if you haven't integrated the Google Mobile Ads SDK correctly. Is your ad implementation code working properly? Test your implementation code to check that ads can show. You can also use ad inspector to test your app's ad serving.

How do I stop AdMob invalid clicks?

Use test ads to avoid generating invalid clicks. It is important to enable test ads during development so that you can click on them without charging Google advertisers. If you click on too many ads without being in test mode, your account can be flagged for invalid activity.

Can't retrieve data AdMob can't retrieve the data for this ad source this could be due to?

AdMob can't retrieve the data for this ad source. This could be due to: Incorrectly mapped ad units. Check that your ad units exist in the third-party ad source and are allowed to serve ads.


2 Answers

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

like image 192
zooter Avatar answered Oct 10 '22 15:10

zooter


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

like image 25
Sourabh soni Avatar answered Oct 10 '22 16:10

Sourabh soni