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.

Crash on Android on AdView.pause()

See original GitHub issue

Describe the bug I received a crashlytics error in production. The error was the following:

Fatal Exception: java.lang.NullPointerException
Attempt to invoke virtual method 'void com.google.android.gms.ads.AdView.pause()' on a null object reference

To Reproduce It’s actually hard to reproduce as this is just a crash which was reported by crashlytics.

Expected behavior The app should not crash 😊

Smartphone (please complete the following information):

  • Device: Samsung Galaxy J7
  • OS: Android 9

Additional context I just wanted to make sure, that every step is taken to prevent that error. It should not be the case, that the app crashes after calling pause.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
distantecommented, Oct 25, 2020

I took a quick look at the code from my phone. There are two problems that I see. One from the plugin, and one (maybe) from your side.

The plugin code handle correctly requests done when the plugin is not initialized, but it asumes that the consumer will never call hideBanner before showBanner.

That last part is the error in your part, probably because of a race condition, you are hiding a banner that was never show.

I will try to handle hide calls of non showed banners this week.

0reactions
NLuegcommented, Oct 26, 2020

Perfect. Thank you!

Read more comments on GitHub >

github_iconTop Results From Across the Web

setVisibility(View.GONE) causes a Crash - Stack Overflow
OK, done that adView.destroy() is hashed out and adView.setVisibility(View.GONE); remains, but it crashes on the setVisibility .
Read more >
AdView Android 13 beta crash [240449675] - Issue Tracker
Every time AdView.loadAd() is called my app crashes with an alert "android services library keeps stopping". The stack-trace for this bug ...
Read more >
App crashes when resuming - java.lang.IllegalStateException ...
Describe the bug Admob shows banner ad without issues. But when app is resumed from background, the app crashes. The following is the...
Read more >
Admob banner ad crash on Android 8.0 - Google Groups
hello, I've received over ten thousand admob banner crash events in firebase since Oct 2019. ... String.intern()' on a null object reference.
Read more >
Random crashes caused by Ads on Android - Unity Forum
I was experiencing frequent crash due to AdMob on android and it was related to ... state of the ads back down when...
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