7
votes

I've got a problem with Admob not showing up Ads...

Here's the LogCat:

WARN/AdMobSDK(502): Ignoring requestFreshAd() because we are requesting an ad right now already.
INFO/AdMobSDK(502): No fill.  Server replied that no ads are available (1164ms)
INFO/AdMobSDK(502): No fill.  Server replied that no ads are available (846ms)

I've tried test mode, no test mode, emulator, real phone, etc. It never shows anything up, but I get requests and prints on Admob stats, like if it ever worked...

AFAIK, I did everything in the Admob Android SDK... the only thing that could be the cause of any problems, IMHO, would be the fact that I'm using tabbed layout with scrollview and then a relativelayout where the ad shows...

Here's a sample of the layout for a tab:

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:myapp="http://schemas.android.com/apk/res/com.xxx.xxx"
    android:id="@+id/tababout"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="#FF000000">
<RelativeLayout
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="#FF000000"
    android:padding="10px">

    <ImageView
        android:id="@+id/label_img"
        android:src="@drawable/about_header"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:adjustViewBounds="true"
        android:scaleType="centerInside" />

    <TextView android:id="@+id/label_know_more_desc"
        style="@style/Desc"
        android:layout_below="@id/label_img"
        android:text="@string/tab_about_know_more_desc" />

    <Button android:id="@+id/bt_know_more"
        style="@style/Button"
        android:gravity="center_vertical|center_horizontal"
        android:layout_below="@id/label_know_more_desc"
        android:text="@string/tab_about_know_more_bt" />

    <com.admob.android.ads.AdView android:id="@+id/ad" android:layout_width="fill_parent" android:layout_height="wrap_content" myapp:backgroundColor="#000000" myapp:primaryTextColor="#FFFFFF" myapp:secondaryTextColor="#CCCCCC" />
</RelativeLayout>
</ScrollView>

And here's the main.xml, not that I think you need it:

<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#FF000000">

<LinearLayout
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

    <TabWidget
        android:id="@android:id/tabs"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" />

    <FrameLayout
        android:id="@android:id/tabcontent"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:background="#FF000000"
        android:paddingTop="5px">

    </FrameLayout>
</LinearLayout>
</TabHost>

I've read in Admob ads will not display when placed inside a tabview that the problem could be the 10px padding I'm throwing in, but even if I disable that, it doesn't work.

I even tried moving the xmlns:myapp to RelativeLayout, but obviously didn't change anything....

Also, I've made my first live ad request over 24 hours ago...

EDIT

Ok, now I'm getting somewhere, I've managed to get test ads showing up (my setTestDevices was too late in the onCreate code, I pushed it up to the first lines), but not real ones... am I missing something? I obviously commented out the setTestDevices line and no ads show up

EDIT 2

Well, I added two internal ads (I already had internal ads enabled, but no internal ads set), and suddenly ads started showing on my app (not only internal ads).

I guess everything altogether made it work?! :)

Thanks everyone!

2

2 Answers

5
votes

You aren't positioning the ad's in the RelativeLayout (they need a layout_above or layout_below or whatever to specify where to put them).

Also there is a minimum size for admob that you might want to ensure you match, I think it's like 48dip in height at least, not sure what the horizontal is.

Lastly I don't know where you are trying to place your ad's, but it probably would make more sense in your main frame-layout, I have a padding at the bottom of my app which I use for the ad-view.

Edit: also if your app is public check for ad-revenue. Android pre 2.3 allowed ad's to be hidden behind views and still register clicks. I actually made my initial $1 before my ad's were even visible by anyone.

0
votes

Another reason that the AdMob Ads won't show up is that you haven't declared the AdActivity which will display the ads when they are clicked on. Without the AdActivity declared in my AndroidManifest.xml, I don't see the ads. With it declared, the Ads show up.

...AndroidManifest.xml...

<!--  AdMob -->
<activity android:name="com.google.ads.AdActivity"
          android:configChanges="keyboard|keyboardHidden|orientation"/>