Interstitial error

133 views
Skip to first unread message

Sean Doyle

unread,
Apr 11, 2014, 9:58:55 PM4/11/14
to google-adm...@googlegroups.com
Every time i try to show an Interstitial ad i get  Failed to load ad: 2. but when i try loading a banner ad it works perfectly?

        interstitial = new InterstitialAd(this);
        interstitial
.setAdUnitId(myker);
        adView
= new AdView(this);
        adView
.setAdSize(AdSize.SMART_BANNER);
        adView
.setAdUnitId(mykey);

       
// Add the AdView to the view hierarchy. The view will have no size
       
// until the ad is loaded.
       
LinearLayout layout = (LinearLayout) findViewById(R.id.adview);
        layout
.addView(adView);

       
// Create an ad request. Check logcat output for the hashed device ID to
       
// get test ads on a physical device.
       
AdRequest adRequest = new AdRequest.Builder().build();
       
AdRequest adRequest2 = new AdRequest.Builder().build();

       
// Start loading the ad in the background.
        adView
.loadAd(adRequest);
        interstitial
.loadAd(adRequest2);
        interstitial
.setAdListener(new AdListener() {
           
@Override
           
public void onAdLoaded() {
                interstitial
.show();
           
}
           
@Override
           
public void onAdFailedToLoad(int error) {
               
Log.i("ERROR", "ERROR:"+error);
           
}
         
});
Enter code here...


Eric Leichtenschlag

unread,
Apr 14, 2014, 3:36:26 PM4/14/14
to google-adm...@googlegroups.com, spd...@gmail.com
That's odd. Error code 2 means network error, but if the first request is going through than your internet connection should be fine.

Do you have a full logcat output of what's going on (ideally with the call to adView.loadAd taken out)?

Thanks,
Eric

Sean Doyle

unread,
Apr 14, 2014, 4:52:15 PM4/14/14
to google-adm...@googlegroups.com, spd...@gmail.com
04-14 16:46:49.776: I/Ads(22817): Use AdRequest.Builder.addTestDevice("removed") to get test ads on this device.
04-14 16:46:49.784: I/dalvikvm(22817): Could not find method android.webkit.WebSettings.getDefaultUserAgent, referenced from method acd.a
04-14 16:46:49.784: W/dalvikvm(22817): VFY: unable to resolve static method 3899: Landroid/webkit/WebSettings;.getDefaultUserAgent (Landroid/content/Context;)Ljava/lang/String;
04-14 16:46:49.784: D/dalvikvm(22817): VFY: replacing opcode 0x71 at 0x0011
04-14 16:46:49.791: I/Ads(22817): Starting ad request.
04-14 16:46:49.846: I/dalvikvm(22817): Could not find method android.webkit.WebSettings.setMediaPlaybackRequiresUserGesture, referenced from method acl.<init>
04-14 16:46:49.846: W/dalvikvm(22817): VFY: unable to resolve virtual method 3914: Landroid/webkit/WebSettings;.setMediaPlaybackRequiresUserGesture (Z)V
04-14 16:46:49.846: D/dalvikvm(22817): VFY: replacing opcode 0x6e at 0x003d
04-14 16:46:51.065: I/Ads(22817): Use AdRequest.Builder.addTestDevice("removed") to get test ads on this device.
04-14 16:46:51.065: I/Ads(22817): Starting ad request.
04-14 16:46:52.268: D/libEGL(22817): loaded /vendor/lib/egl/libEGL_POWERVR_SGX540_120.so
04-14 16:46:52.307: D/libEGL(22817): loaded /vendor/lib/egl/libGLESv1_CM_POWERVR_SGX540_120.so
04-14 16:46:52.315: D/libEGL(22817): loaded /vendor/lib/egl/libGLESv2_POWERVR_SGX540_120.so
04-14 16:46:52.424: D/OpenGLRenderer(22817): Enabling debug mode 0
04-14 16:46:52.432: I/Choreographer(22817): Skipped 54 frames!  The application may be doing too much work on its main thread.
04-14 16:46:52.807: W/ResourceType(22817): Requesting resource 0x7f0b000e failed because it is complex
04-14 16:46:52.838: E/GooglePlayServicesUtil(22817): The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.
04-14 16:46:53.041: E/GooglePlayServicesUtil(22817): The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.
04-14 16:46:53.088: E/GooglePlayServicesUtil(22817): The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.
04-14 16:46:53.120: E/GooglePlayServicesUtil(22817): The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.
04-14 16:46:59.229: W/Ads(22817): There was a problem getting an ad response. ErrorCode: 2
04-14 16:46:59.284: W/Ads(22817): Failed to load ad: 2
04-14 16:46:59.284: I/ERROR(22817): ERROR:2
04-14 16:47:02.151: D/dalvikvm(22817): GC_FOR_ALLOC freed 934K, 11% free 8937K/9955K, paused 46ms, total 56ms
04-14 16:47:02.151: D/webviewglue(22817): nativeDestroy view: 0x4d2cb2d8
04-14 16:47:02.166: D/webviewglue(22817): nativeDestroy view: 0x4d2cb420
04-14 16:47:05.229: D/libc(22817): Forward DNS query to netd(h=lh6.ggpht.com s=^)
04-14 16:47:05.229: D/libc(22817): Forward DNS query to netd(h=googleads.g.doubleclick.net s=^)
04-14 16:47:06.377: D/libc(22817): Forward DNS query to netd(h=csi.gstatic.com s=^)
04-14 16:47:07.502: I/Ads(22817): Scheduling ad refresh 60000 milliseconds from now.
04-14 16:47:07.510: I/Ads(22817): Ad finished loading.



Sean Doyle

unread,
Apr 14, 2014, 4:54:27 PM4/14/14
to google-adm...@googlegroups.com, spd...@gmail.com
Could it have something to do with the key?

Eric Leichtenschlag

unread,
Apr 14, 2014, 6:11:05 PM4/14/14
to google-adm...@googlegroups.com, spd...@gmail.com
Hey Sean,

What Android version are you running on your device? The logs are complaining about calls to android.webkit.WebSettings.getDefaultUserAgent and android.webkit.WebSettings.setMediaPlaybackRequiresUserGesture which are called from the SDK but only get called if your device is API 17 or higher. And if your device is API 17 or higher (Android 4.2), then the method should exist. Maybe you're running some special version of Android or some mod which is causing this issue?

Thanks,
Eric

Sean Doyle

unread,
Apr 14, 2014, 6:16:33 PM4/14/14
to google-adm...@googlegroups.com, spd...@gmail.com
I'm running 4.2.1 by Motorola,my device is a Droid Bionic.

Eric Leichtenschlag

unread,
Apr 14, 2014, 6:33:21 PM4/14/14
to google-adm...@googlegroups.com, spd...@gmail.com
Is it a standard build? Do you have cyanogenmod or some other mod on the device? I'm asking because Wikipedia is saying that last OTA build pushed was 4.1.2.

Can you get ads back on another device or simulator?

Sean Doyle

unread,
Apr 14, 2014, 6:39:29 PM4/14/14
to google-adm...@googlegroups.com, spd...@gmail.com
sorry i typed it wrong its 4.1.2. and the interstitial ads dont work on any of my other devices at all.

Eric Leichtenschlag

unread,
Apr 14, 2014, 6:54:04 PM4/14/14
to google-adm...@googlegroups.com, spd...@gmail.com
Can you log the value of android.os.Build.VERSION.SDK_INT? I'd expect to see 16 and not 17 on your Droid Bionic.

Sean Doyle

unread,
Apr 14, 2014, 7:20:15 PM4/14/14
to google-adm...@googlegroups.com, spd...@gmail.com
its 16

Eric Leichtenschlag

unread,
Apr 15, 2014, 7:05:09 PM4/15/14
to google-adm...@googlegroups.com, spd...@gmail.com
Can you try logging this? This if statement is what the SDK uses to determine whether it can call the getDefaultUserAgent method.
Log.i("MyApp", String.valueOf(Build.VERSION.SDK_INT));
Log.i("MyApp", String.valueOf(Build.VERSION_CODES.JELLY_BEAN_MR1));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
 
Log.e("MyApp", "My Android OS version is at least Jelly Bean MR1. I shouldn't have gotten here on my Droid Bionic");
} else {
 
Log.i("MyApp", "My Android OS version is less than Jelly Bean MR1");
}




Sean Doyle

unread,
Apr 16, 2014, 9:59:18 AM4/16/14
to google-adm...@googlegroups.com, spd...@gmail.com
i got
04-16 09:57:22.289: I/MyApp(17457): 16
04-16 09:57:22.289: I/MyApp(17457): 17
04-16 09:57:22.289: I/MyApp(17457): My Android OS version is less than Jelly Bean MR1

Eric Leichtenschlag

unread,
Apr 16, 2014, 2:24:00 PM4/16/14
to google-adm...@googlegroups.com, spd...@gmail.com
Ok, I'm going to ignore the dalvikvm comments then. That brings me back to square 1 though - I have no idea what the problem may be.

Could you send over a sample app or an apk that has the issue? I can try running on my device and see if I get the same result. My best guess at this point is it's still device-specific.

Sean Doyle

unread,
Apr 16, 2014, 4:06:25 PM4/16/14
to google-adm...@googlegroups.com, spd...@gmail.com

Eric Leichtenschlag

unread,
Apr 16, 2014, 6:44:48 PM4/16/14
to google-adm...@googlegroups.com, spd...@gmail.com
I'm failing to get an interstitial, but for me the error code is 3, which is no fill. The reason for that is that the ad unit you created on apps.admob.com had the "Banner" type and only gets back banners. You'll need to create a separate ad unit with the "Interstitial" ad type and pass that into the interstitial.setAdUnitId method.

On Wednesday, April 16, 2014 1:06:25 PM UTC-7, Sean Doyle wrote:
Reply all
Reply to author
Forward
0 new messages