question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Fatal Exception: java.lang.NullPointerException nativeAd.body must not be null

See original GitHub issue

Plugin Version

0.13.0

Steps to Reproduce

  1. Log captured by Crashlytics from live Android app.

Expected results: Native ads should be displayed in Android app without crashing

Actual results: Android app is crashing with Fatal Exception: java.lang.NullPointerException nativeAd.body must not be null

Logs

Fatal Exception: java.lang.NullPointerException: nativeAd.body must not be null at com.app.ListTileNativeAdFactory.createNativeAd(ListTileNativeAdFactory.java:190) at io.flutter.plugins.googlemobileads.FlutterNativeAd$1.onNativeAdLoaded(FlutterNativeAd.java:12) at com.google.android.gms.internal.ads.zzatv.zze(zzatv.java:7) at com.google.android.gms.internal.ads.zzait.zzbA(zzait.java:31) at com.google.android.gms.internal.ads.zzhx.onTransact(zzhx.java:20) at android.os.Binder.transact(Binder.java:675) at fu.bi(fu.java:2) at com.google.android.gms.ads.internal.formats.client.ak.e(ak.java) at com.google.android.gms.ads.nonagon.ad.nativead.ad.run(ad.java:5) at android.os.Handler.handleCallback(Handler.java:873) at android.os.Handler.dispatchMessage(Handler.java:99) at apc.a(apc.java) at com.google.android.gms.ads.internal.util.zzae.a(zzae.java:1) at apc.dispatchMessage(apc.java) at android.os.Looper.loop(Looper.java:214) at android.app.ActivityThread.main(ActivityThread.java:7094) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:975)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5

github_iconTop GitHub Comments

2reactions
cpsanpedrocommented, Jul 29, 2021

you have to check if body is null in your Ad factory (code in Kotlin) if (nativeAd.body?.isNotEmpty() == true) { text = nativeAd.body visibility = View.VISIBLE } else { View.INVISIBLE }

Thanks! This worked! The codelab from google does not work.

1reaction
djaducommented, Jul 17, 2021

you have to check if body is null in your Ad factory (code in Kotlin) if (nativeAd.body?.isNotEmpty() == true) { text = nativeAd.body visibility = View.VISIBLE } else { View.INVISIBLE }

Read more comments on GitHub >

github_iconTop Results From Across the Web

FATAL EXCEPTION java.lang.NullPointerException: null ...
Here one of the variables from document is coming as null which cannot be cast to non-nullable String type in kotlin. If you...
Read more >
Admin SDK error handling - Firebase - Google
Java : Throws instances of IllegalArgumentException , NullPointerException or ... In most situations you should not explicitly handle programming errors.
Read more >
nullpointer exception on nativead [ getContext() or getActivity()]
It is your call to getContext() that is throwing the null pointer exception. This can happen for a number of reasons, and is...
Read more >
Audience Network SDK for Android Change Log
RuntimeException : Unable to pause activity {com.your.app/com.facebook.ads.AudienceNetworkActivity}: java.lang.NullPointerException for Carousel Interstitials.
Read more >
Viewing online file analysis results for '2220.apk'
Not all malicious and suspicious indicators are displayed. ... return null on previousSibling and nextSibling instead of throwing a null pointer exception.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found