Admob 在 Android 应用程序中导致 NullPointerException

Admob causes NullPointerException in android apps(Admob 在 Android 应用程序中导致 NullPointerException)
本文介绍了Admob 在 Android 应用程序中导致 NullPointerException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

自上周以来,由于一些 admob 错误,我的应用在生产版本中出现了致命错误

Since last week i'm getting a fatal error in my app in production release due some admob bug

Fatal Exception: java.lang.NullPointerException: Attempt to read from field 'com.google.android.gms.ads.internal.overlay.n com.google.android.gms.ads.internal.overlay.AdOverlayInfoParcel.c' on a null object reference
       at com.google.android.gms.ads.internal.overlay.k.f(k.java)
       at com.google.android.gms.ads.internal.overlay.client.b.a(b.java:1)
       at fy.onTransact(fy.java:4)
       at android.os.Binder.transact(Binder.java:662)
       at com.google.android.gms.internal.ads.zzgu.zzb(zzgu.java:21)
       at com.google.android.gms.internal.ads.zzarl.onUserLeaveHint(zzarl.java:54)
       at com.google.android.gms.ads.AdActivity.onUserLeaveHint(AdActivity.java:32)
       at android.app.Activity.performUserLeaving(Activity.java:7470)
       at android.app.Instrumentation.callActivityOnUserLeaving(Instrumentation.java:1476)
       at android.app.ActivityThread.performUserLeavingActivity(ActivityThread.java:4034)
       at android.app.ActivityThread.handlePauseActivity(ActivityThread.java:4016)
       at android.app.servertransaction.PauseActivityItem.execute(PauseActivityItem.java:45)
       at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:145)
       at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:70)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1839)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loop(Looper.java:201)
       at android.app.ActivityThread.main(ActivityThread.java:6864)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)

我无法在测试中重现该问题.但正如堆栈所示,这是由于 admob api 响应 android 本机事件的一些内部调用而引起的.

I was not able to reproduce the problem in test. but as the stack shows it is caused due some inner call of the admob api responding to android native events.

我正在使用的版本:

'com.google.gms:google-services:4.3.4'
api "com.google.android.gms:play-services-location:17.1.0"
api 'com.google.android.gms:play-services-ads:19.5.0'

推荐答案

最好是尝试记录 Ad response id 以基本查看是否有某种类型的 Ad 导致 App 崩溃.如果是,您需要在广告管理器中搜索广告并阻止其投放.https://developers.google.com/ad-manager/移动广告 SDK/android/crashlytics

Best is try logging the Ad response id to basically see if there is a certain type of Ad crashing the App. If yes you need to search for Ad in Ad manager and block it from serving. https://developers.google.com/ad-manager/mobile-ads-sdk/android/crashlytics

这篇关于Admob 在 Android 应用程序中导致 NullPointerException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

How to target newer versions in .gitlab-ci.yml using auto devops (java 11 instead of 8 and Android 31 instead of 29)(如何在.gitlab-ci.yml中使用自动开发工具(Java 11而不是8,Android 31而不是29)瞄准较新的版本)
Android + coreLibraryDesugaring: which Java 11 APIs can I expect to work?(Android+core LibraryDesugering:我可以期待哪些Java 11API能够工作?)
How to render something in an if statement React Native(如何在If语句中呈现某些内容Reaction Native)
How can I sync two flatList scroll position in react native(如何在本机Reaction中同步两个平面列表滚动位置)
Using Firebase Firestore in offline only mode(在仅脱机模式下使用Firebase FiRestore)
Crash on Google Play Pre-Launch Report: java.lang.NoSuchMethodError(Google Play发布前崩溃报告:java.lang.NoSuchMethodError)