Admob test ads load OK when in test but real ads fail to load when not in test mode

1,029 views
Skip to first unread message

Scott Baker

unread,
Dec 30, 2014, 12:34:33 AM12/30/14
to google-adm...@googlegroups.com
Hi,

I am new to Android development and I am trying to integrate AdMob into my first app.
The run in the emulator, or in test mode on a real device, the test ads are displayed OK, but
when I try to run in non test mode, no ads are displayed. 

>> development tools
Eclipse

>> Google Play services SDK version you're integrating with
version 22 (as shown in SDK manager)

>> Version of the Google Play services apk installed on your device
I don't know what this means .. I am using
            android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version"

>> model and OS version of the device that exhibits the issue
I have tried this on 2 OS versions: (Samsung) 2.3.6 and (Blu) 4.2.2


logcat output:

12-29 21:08:54.644: D/dalvikvm(18645): DEX prep '/data/data/com.sierracircuit.concentration/cache/ads1329792925.jar': unzip in 0ms, rewrite 277ms
12-29 21:08:54.803: D/libEGL(18645): loaded /system/lib/egl/libEGL_mali.so
12-29 21:08:54.809: D/libEGL(18645): loaded /system/lib/egl/libGLESv1_CM_mali.so
12-29 21:08:54.814: D/libEGL(18645): loaded /system/lib/egl/libGLESv2_mali.so
12-29 21:08:54.832: D/OpenGLRenderer(18645): Enabling debug mode 0
12-29 21:08:54.838: V/InputMethodManager(18645): onWindowFocus: null softInputMode=288 first=true flags=#1810100
12-29 21:08:54.839: V/InputMethodManager(18645): START INPUT: com.android.internal.policy.impl.PhoneWindow$DecorView{41267228 V.E..... R.....ID 0,0-480,854} ic=null tba=android.view.inputmethod.EditorInfo@41383250 controlFlags=#104
12-29 21:08:54.847: V/InputMethodManager(18645): Starting input: Bind result=InputBindResult{null com.android.inputmethod.latin/.LatinIME #790}
12-29 21:08:54.927: I/InputMethodManager(18645): handleMessage: MSG_SET_ACTIVE true, was false
12-29 21:08:56.205: I/Ads(18645): No fill from ad server.
12-29 21:08:56.220: I/dalvikvm(18645): Could not find method android.webkit.WebView.evaluateJavascript, referenced from method com.google.android.gms.ads.internal.o.a.evaluateJavascript
12-29 21:08:56.220: W/dalvikvm(18645): VFY: unable to resolve virtual method 3114: Landroid/webkit/WebView;.evaluateJavascript (Ljava/lang/String;Landroid/webkit/ValueCallback;)V
12-29 21:08:56.220: D/dalvikvm(18645): VFY: replacing opcode 0x6f at 0x0016
12-29 21:08:56.251: I/webkit/webview_proxy(18645): WebView() constructor=com.google.android.gms.ads.internal.o.a{41398288 VFE.HV.. ......I. 0,0-0,0}
12-29 21:08:56.279: V/Provider/Settings(18645): invalidate [system]: current 156 != cached 0
12-29 21:08:56.281: V/Provider/Settings(18645): from db cache, name = show_password , value = null
12-29 21:08:56.285: D/webkit/webcore(18645): sWebCoreHandler.handleMessage() 0 obj=android.webkit.WebViewCore@4139bb98
12-29 21:08:56.329: W/Ads(18645): Failed to load ad: 3

AndroidManifest.xml:

blah blah blah ..

    <uses-sdk
        android:minSdkVersion="10"                  <-- I have also tried minSdkVersion 13 .. but the results were the same -->
        android:targetSdkVersion="21" />

    <!-- admob required permissions -->
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

    <application

blah blah blah ..

        <!-- admob version -->
        <meta-data
            android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version" />

        <!-- admob publisher ID -->
        <meta-data
            android:value="pub-xxxxxxxxxxxxxxx"
            android:name="ADMOB_PUBLISHER_ID"/> 

        <!-- admob activity -->
        <activity
            android:name="com.google.android.gms.ads.AdActivity"
            android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />

    </application>


main.xml:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

blah blah blah ..

    <!-- admob view -->
    <com.google.android.gms.ads.AdView
        android:id="@+id/adMob"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        ads:adSize="BANNER"
        ads:adUnitId="@string/admob_id" />

</LinearLayout>


main.java onCreate method:

    @Override public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        boolean testAdMob = false;
        String deviceId;
        AdRequest adRequest;

        adView = (AdView) this.findViewById(R.id.adMob);

        if (testAdMob) {
            // get the device ID
            deviceId = getdeviceID();
            Log.d("debug deviceID", deviceId);
            // configure for test ads to avoid Google policy violation
            adRequest = new AdRequest.Builder()
                .addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
                .addTestDevice(deviceId)
                .build();
            checkTestID(adRequest);
        } else {
            adRequest = new AdRequest.Builder()
                .addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
                .build();
        }
        adView.loadAd(adRequest);
    }


Thanks,
Scott

Andrew Brogdon (Mobile Ads SDK Team)

unread,
Dec 30, 2014, 12:45:00 PM12/30/14
to google-adm...@googlegroups.com
First, thanks for posting such a detailed question.  Makes it a lot easier to tell what's going on.  :)

Error Code 3 means "No Fill."  That indicates AdMob was unable to find an ad to display in your app at that particular moment. Under normal circumstances this doesn't happen very often, so if you're seeing it repeatedly, it probably indicates an issue with the ad unit for your banner.  Let me ask you a few questions:

1) Have you registered your account as an AdMob developer on AdMob.com?
2) If so, did you create an Ad Unit ID for banner ads?
3) If so, is that the ID in your strings.xml file referenced by "@string/admob_id"?

If the answer to any of those is no, you've found your issue.  If you're going through our quick start and still have the provided test Ad Unit ID in your strings.xml file, that will prevent you from getting fill when you leave test mode (that Ad Unit ID only serves test ads, and ignores requests for production ones).

On a related note, if you're new to Android development, I would highly recommend getting started with Android Studio rather than Eclipse. It's the official IDE for Android development, and we just released version 1.0. 

-Andrew

Scott Baker

unread,
Dec 30, 2014, 4:03:14 PM12/30/14
to google-adm...@googlegroups.com
>>2) If so, did you create an Ad Unit ID for banner ads?
AhHa !! That was it :)

The problem is fixed now and the banner ads are now being displayed.

Thanks!!
Scott
> --
>
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "Google Mobile Ads SDK Developers" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/google-admob-ads-sdk/YILQ41EXPCA/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> google-admob-ads...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Andrew Brogdon (Mobile Ads SDK Team)

unread,
Dec 30, 2014, 4:39:02 PM12/30/14
to google-adm...@googlegroups.com
Glad to be of service.  Happy coding, and welcome to Android.  :)

-Andrew

Reply all
Reply to author
Forward
0 new messages