Reputation: 14408
I experienced a lot of crash in my app using ads from Facebook’s Audience Network.Here is the report:
NullPointerException (@FBInterstitial:InitInterstitialAd:-1) {Thread:main Exception:java.lang.NullPointerException at android.webkit.WebSettingsClassic.getDefaultUserAgentForLocale(WebSettingsClassic.java:453) at android.webkit.WebViewClassic$Factory.getDefaultUserAgent(WebViewClassic.java:1503) at android.webkit.WebSettings.getDefaultUserAgent(WebSettings.java:1280) at com.facebook.ads.a.s.a(Unknown Source) at com.facebook.ads.a.s.a(Unknown Source) at com.facebook.ads.a.j.(Unknown Source) at com.facebook.ads.a.k.b(Unknown Source) at com.facebook.ads.InterstitialAd.loadAd(Unknown Source)
It happens at mInterstitialAd.show();
where mInterstitialAd
is instance of facebook InterstitialAd and it call show() method of InterstitialAd
class.
I also did check nullability for mInterstitialAd
as
if (mInterstitialAd != null && mInterstitialAd.isAdLoaded()) {
mInterstitialAd.show();
}
As you can see the error prompt when try to show a new ad. Anyone that has this error know how to solve it?
Note : I am using AudienceNetwork.jar
file.And from log it seems that error in method a
of class s
(see code below) which is in com.facebook.ads.a
package (available in jar file.)
// IntelliJ API Decompiler stub source generated from a class file
// Implementation of methods is not available
package com.facebook.ads.a;
public class s {
private static java.lang.String a;
public static void a(android.webkit.WebView webView, android.webkit.WebViewClient webViewClient, com.facebook.ads.a.r r) { /* compiled code */ }
public static void a(android.webkit.WebView webView) { /* compiled code */ }
public static java.lang.String a() { /* compiled code */ }
public static java.lang.String a(android.content.Context context, com.facebook.ads.a.o o) { /* compiled code */ }
private static java.lang.String a(android.content.Context context, java.lang.String s, java.lang.String s1) { /* compiled code */ }
@android.annotation.TargetApi(17)
private static java.lang.String a(android.content.Context context) { /* compiled code */ }
}
Edit Initialize it as
mInterstitialAd = new InterstitialAd(mContext, "FaceBookPlacementID");
mInterstitialAd.setAdListener(this);
mInterstitialAd.loadAd();
Upvotes: 1
Views: 2105
Reputation: 171
Looks very similar to this issue: https://groups.google.com/forum/#!topic/google-admob-ads-sdk/SX9yb3F_PNk
But we can surround the call from our SDK with a try/catch that has a fallback to grab the UA a different way. Will put out a hotfix tomorrow. Please report back if you still see the issue in 4.1.1.
Upvotes: 1