NullPointerException from December

173 views
Skip to first unread message

sungsu...@socialnmobile.com

unread,
Jan 25, 2021, 11:52:05 PM1/25/21
to Google Mobile Ads SDK Developers
I could not reproduce the issue on my device but I can see this crash logs much in the play console. The crash starts from Dec 2020 and it is increased more in Jan 2021.

admob_crash202101.png

It seems to be related to the native ads. Could I know what causes the issue?

java.lang.NullPointerException : Attempt to invoke virtual method 'android.content.Context android.view.View.getContext()' on a null object reference

Samsung Galaxy A01 Core, Android 10 (SDK 29)

java.lang.NullPointerException: 
  at com.google.android.gms.ads.nonagon.ad.nativead.bj.run (Unknown Source)
  at com.google.android.gms.ads.internal.util.future.c.execute (com.google.android.gms.policy_ads_fdr_dynamite@204204100@204204100000.336078696.336078696:2)
  at com.google.android.gms.ads.internal.util.future.d.execute (com.google.android.gms.policy_ads_fdr_dynamite@204204100@204204100000.336078696.336078696)
  at com.google.android.gms.ads.nonagon.ad.nativead.aj.h (com.google.android.gms.policy_ads_fdr_dynamite@204204100@204204100000.336078696.336078696:2)
  at com.google.android.gms.ads.nonagon.ad.nativead.ag.run (Unknown Source)
  at android.os.Handler.handleCallback (Handler.java:883)
  at android.os.Handler.dispatchMessage (Handler.java:100)
  at ql.a (com.google.android.gms.policy_ads_fdr_dynamite@204204100@204204100000.336078696.336078696)
  at com.google.android.gms.ads.internal.util.f.a (com.google.android.gms.policy_ads_fdr_dynamite@204204100@204204100000.336078696.336078696:1)
  at ql.dispatchMessage (com.google.android.gms.policy_ads_fdr_dynamite@204204100@204204100000.336078696.336078696)
  at android.os.Looper.loop (Looper.java:214)
  at android.app.ActivityThread.main (ActivityThread.java:7438)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:493)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:989)

Mobile Ads SDK Forum Advisor Prod

unread,
Jan 26, 2021, 2:18:47 AM1/26/21
to sungsu...@socialnmobile.com, google-adm...@googlegroups.com

Hi there,

Thank you for reaching out to us.

The team is currently aware of this particular issue, and is actively working on a fix for this. We'll keep you updated for any developments on this.

Google Logo
Ziv Yves Sanchez
Mobile Ads SDK Team
 


ref:_00D1U1174p._5004Q2B3MiQ:ref

Teng-Pao Yu

unread,
Jan 27, 2021, 12:58:43 AM1/27/21
to Google Mobile Ads SDK Developers
We're seeing the same situation degrading from impacting 0.1% of our daily users to 0.15% last week as well. We've noticed four crashes rocketing beginning in the first week of December as op had described. There are two crash stacks both sharing the same problematic line and the two crashes combined are occuring 7x more frequently than all other crashes combined in our environment.

While our team still does not yet have a reproduce step, I have decompiled the problematic line and noticed NPE candidates and am anticipating a simple fix might resolve the issue in the Google Play Service.

I've attached the simplified snippet in the class bj.java. There are three references but only one usage is nullable-aware.

We're seeing the problems in both `21.02.14` and `20.50.16`.

```
    public RunnableC1877bj(C1880bm bmVar, AbstractView$OnClickListenerC1902ch chVar) {
        this.f6827a = bmVar;
        this.f6828b = chVar;
    }

    public final void run() {
        ...
        // Crash candidate 1!
        Context context = chVar.mo2962c().getContext();
        RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(-2, -2);
        ...
        if (view != null) {
            if (view.getParent() instanceof ViewGroup) {
                ((ViewGroup) view.getParent()).removeView(view);
            }
            if (viewGroup != null) {
                viewGroup.removeAllViews();
                viewGroup.addView(view);
            } else {
                // Crash candidate 2!
                C0381a aVar2 = new C0381a(chVar.mo2962c().getContext());
                aVar2.setLayoutParams(new FrameLayout.LayoutParams(-1, -1));
                aVar2.addView(view);
                FrameLayout b = chVar.mo2961b();
                if (b != null) {
                    b.addView(aVar2);
                }
            }
            chVar.mo2960a(chVar.mo2968h(), view);
        }
        ...
        bmVar.f6839g.execute(new RunnableC1878bk(bmVar, viewGroup2));
        if (viewGroup2 != null) {
            if (!bmVar.mo2983a(viewGroup2)) {
                viewGroup2.removeAllViews();
                // Safe usage
                View c = chVar.mo2962c();
                Context context2 = c != null ? c.getContext() : null;
        ...
        }
    }
}
```
The two crash stack traces are:
```
Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.Context android.view.View.getContext()' on a null object reference
       at com.google.android.gms.ads.nonagon.ad.nativead.bj.run(bj.java)
       at com.google.android.gms.ads.internal.util.future.c.execute(c.java:2)
       at com.google.android.gms.ads.internal.util.future.d.execute(d.java)
       at com.google.android.gms.ads.nonagon.ad.nativead.aj.h(aj.java:2)
       at com.google.android.gms.ads.nonagon.ad.nativead.ag.run(ag.java)
       at android.os.Handler.handleCallback(Handler.java:883)
       at android.os.Handler.dispatchMessage(Handler.java:100)
       at qd.a(qd.java)
       at com.google.android.gms.ads.internal.util.f.a(f.java:1)
       at qd.dispatchMessage(qd.java)
       at android.os.Looper.loop(Looper.java:237)
       at android.app.ActivityThread.main(ActivityThread.java:8167)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:496)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1100)
```
```
Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.Context android.view.View.getContext()' on a null object reference
       at com.google.android.gms.ads.nonagon.ad.nativead.bj.run(bj.java)
       at com.google.android.gms.ads.internal.util.future.c.execute(c.java:2)
       at com.google.android.gms.ads.internal.util.future.d.execute(d.java)
       at com.google.android.gms.ads.nonagon.ad.nativead.aj.h(aj.java:2)
       at com.google.android.gms.ads.nonagon.ad.nativead.ag.run(ag.java)
       at android.os.Handler.handleCallback(Handler.java:739)
       at android.os.Handler.dispatchMessage(Handler.java:95)
       at ql.a(ql.java)
       at com.google.android.gms.ads.internal.util.f.a(f.java:1)
       at ql.dispatchMessage(ql.java)
       at android.os.Looper.loop(Looper.java:148)
       at android.app.ActivityThread.main(ActivityThread.java:7422)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
```

Mobile Ads SDK Forum Advisor Prod

unread,
Jan 27, 2021, 4:00:34 AM1/27/21
to tengp...@smartnews.com, google-adm...@googlegroups.com

Hi Teng-Pao,

Thank you for reaching out to us, and for sharing your insights on this matter.

I will be sharing your insights to the rest of the team in order to help with the investigation, which should hopefully bring this issue's resolution up to speed. We'll keep this thread updated for new developments.
 

Teng-Pao Yu

unread,
Feb 16, 2021, 7:17:09 AM2/16/21
to Google Mobile Ads SDK Developers
The issue seems to be resolved beginning on 2/15 probably following the release of gms 21.02.14.

Mobile Ads SDK Forum Advisor Prod

unread,
Feb 16, 2021, 8:37:11 AM2/16/21
to tengp...@smartnews.com, google-adm...@googlegroups.com
Hi Teng-Pao,

I work with Sherwin and will assist you. Thank you for reporting this, I raised this information with my team. If the issue regresses please report back.


Regards,

Google Logo
Aryeh Baker
Mobile Ads SDK Team
 


ref:_00D1U1174p._5004Q2B3MiQ:ref
Reply all
Reply to author
Forward
0 new messages