Crashes with java.lang.NullPointerException

344 views
Skip to first unread message

Hamid Alaei

unread,
Nov 9, 2020, 2:09:51 AM11/9/20
to Google Mobile Ads SDK Developers
Hi there. We have many crash reports in our new app release with the following stack. I am suspicious this might happen when showing interstitial ads possibly when mediation (Facebook) is enabled, but I am not sure. Using mediation is the only change I can think is relevant in the new release of our app. The app is developed with React Native and we are using https://github.com/sbugert/react-native-admob.
```
com.google.android.gms:play-services-gass@@19.5.0:2413com.google.android.gms.internal.ads.zzelw.zza
com.google.android.gms:play-services-gass@@19.5.0:93com.google.android.gms.internal.ads.zzekh.zza
com.google.android.gms:play-services-gass@@19.5.0:136com.google.android.gms.internal.ads.zzekh.zzb
com.google.android.gms:play-services-gass@@19.5.0:134com.google.android.gms.internal.ads.zzekh.zza
com.google.android.gms:play-services-gass@@19.5.0:28com.google.android.gms.internal.ads.zzgt.zzb
com.google.android.gms:play-services-gass@@19.5.0:118com.google.android.gms.internal.ads.zzdui.zzej
com.google.android.gms:play-services-gass@@19.5.0:10com.google.android.gms.internal.ads.zzdui.zzp
com.google.android.gms:play-services-ads@@19.5.0:173com.google.android.gms.internal.ads.zzdp.zzp
com.google.android.gms:play-services-ads@@19.5.0:40com.google.android.gms.internal.ads.zzdp.zzbq
com.google.android.gms:play-services-ads@@19.5.0:9com.google.android.gms.internal.ads.zzdp.zza
com.google.android.gms:play-services-ads@@19.5.0:103com.google.android.gms.ads.internal.zzf.run
ThreadPoolExecutor.java:1167java.util.concurrent.ThreadPoolExecutor.runWorker
ThreadPoolExecutor.java:641java.util.concurrent.ThreadPoolExecutor$Worker.run
Thread.java:919java.lang.Thread.run
```
Could you please help me fix the issue?
Thanks

Mobile Ads SDK Forum Advisor Prod

unread,
Nov 9, 2020, 4:51:52 AM11/9/20
to hami...@gmail.com, google-adm...@googlegroups.com

Hi Hamid,

Thank you for reaching out to us. However, I'm afraid that we are unable to provide assistance on scenarios where the AdMob SDK is used alongside a 3rd-party SDK (such as React Native). I would recommend posting your concern directly to their github support issue page for further assistance.

We will be glad to help if you encounter any implementation issue with our SDK.


Regards,

Google Logo
Sherwin Diesta
Mobile Ads SDK Team
 


ref:_00D1U1174p._5004Q2789j6:ref

Hamid Alaei

unread,
Nov 9, 2020, 6:27:31 AM11/9/20
to Google Mobile Ads SDK Developers
Based on the stack trace, I am not sure the issue is 100% related to third part packages. Maybe you could provide a better exception handling, e.g. throwing some other exception with appropriate messages before passing null to a function that shouldn't receive null. It isn't clear what goes wrong here, even if it isn't a third party package.
I have sent an issue to the package maintainer as well. There is clearly nothing wrong with react bridge. The package may or may not have issues however. I hope they can reach you if it is necessary: https://github.com/sbugert/react-native-admob/issues/535

Mobile Ads SDK Forum Advisor Prod

unread,
Nov 9, 2020, 9:43:33 AM11/9/20
to hami...@gmail.com, google-adm...@googlegroups.com
HI Hamid,

Thank you for the response back. I work along with Sherwin and will be assisting you today. As previously stated by him, we are unable to offer support for 3rd party SDK's. Having seen that you messaged them, we would suggest definitely following up with them and seeing what advise they have to offer.

Regards,
Google Logo
William Pescherine
Mobile Ads SDK Team
 


ref:_00D1U1174p._5004Q2789j6:ref

Hamid Alaei

unread,
Dec 8, 2020, 4:38:48 AM12/8/20
to Google Mobile Ads SDK Developers
Hello again,
I think this is an exception introduced between play-services-ads@@19.5.0 and 19.4.0. We are using 2 packages for Ads, one for interstitial, the other for native. We are also customizing those packages for our needs.
Here is some historical data to back-up me thinking the bug is new and it is most probably inside play-services-ads:

1. Version 1.3.2 of our app (release date: 2020-09-06):
In this version of our app we didn't have any issues. Dependencies are as followed:
1.1. react-native-admob -> com.google.android.gms:play-services-ads:+ (resolved by version 19.3.0 for the time of release)
1.2. ammarahm-ed/react-native-admob-native-ads -> com.google.android.gms:play-services-ads:19.2.0

2. Version 1.4.4 of our app (release date: 2020-10-31):
In this version, we only have crashes while react-native-admob was in the middle of loading ad. Here are the dependency versions.
1.1. react-native-admob -> com.google.android.gms:play-services-ads:+ (resolved by version 19.5.0 for the time of release)
1.2. ammarahm-ed/react-native-admob-native-ads -> com.google.android.gms:play-services-ads:19.2.0
We didn't received any bug during loading native ads by ammarahm-ed/react-native-admob-native-ads, probably because the underlying package was depending on an older version of play-services-ads.

3. Version 1.5.0 or our app (release date: 2020-12-05):
In this version, we see crashes in both packages during loadAd, since the dependency of both packages was updated:
1.1. react-native-admob (our fork at https://github.com/halaei/react-native-admob/tree/fix-build-gradle) -> com.google.android.gms:play-services-ads:19.+ (resolved by version 19.6.0 for the time of release)
1.2. ammarahm-ed/react-native-admob-native-ads (our custom fork at https://github.com/ha-younes72/react-native-admob-native-ads/tree/ad-preload) -> com.google.android.gms:play-services-ads:19.+ (resolved by version 19.6.0 for the time of release)

My colleague Younes is working on both the packages. He can give you extra information if necessary. I guess it is safe to say that you can now support us, because there is no third party sdk involved, our dependencies are now all first party:)

Thanks for your help in advance.


Younes hassani abdollahi

unread,
Dec 8, 2020, 5:01:44 AM12/8/20
to Google Mobile Ads SDK Developers
Hi,

The error reported by the native ad package (https://github.com/ha-younes72/react-native-admob-native-ads/tree/ad-preload) is in the line of code with the below URL:

https://github.com/ha-younes72/react-native-admob-native-ads/blob/c0994a2617f09907a06601e20a5b24653b60907e/android/src/main/java/com/ammarahmed/rnadmob/nativeads/RNAdMobUnifiedAdQueueWrapper.java#L179

and the error itself is as:

java.lang.NullPointerException
        at com.google.android.gms.internal.ads.zzemh.zza(com.google.android.gms:play-services-gass@@19.6.0:2415)
        at com.google.android.gms.internal.ads.zzekq.zza(com.google.android.gms:play-services-gass@@19.6.0:93)
        at com.google.android.gms.internal.ads.zzekq.zzb(com.google.android.gms:play-services-gass@@19.6.0:136)
        at com.google.android.gms.internal.ads.zzekq.zza(com.google.android.gms:play-services-gass@@19.6.0:134)
        at com.google.android.gms.internal.ads.zzgt.zzb(com.google.android.gms:play-services-gass@@19.6.0:28)
        at com.google.android.gms.internal.ads.zzdum.zzek(com.google.android.gms:play-services-gass@@19.6.0:118)
        at com.google.android.gms.internal.ads.zzdum.zzp(com.google.android.gms:play-services-gass@@19.6.0:10)
        at com.google.android.gms.internal.ads.zzdp.zzp(com.google.android.gms:play-services-ads@@19.6.0:173)
        at com.google.android.gms.internal.ads.zzdp.zzbq(com.google.android.gms:play-services-ads@@19.6.0:40)
        at com.google.android.gms.internal.ads.zzdp.zza(com.google.android.gms:play-services-ads@@19.6.0:9)
        at com.google.android.gms.ads.internal.zzf.run(com.google.android.gms:play-services-ads@@19.6.0:103)
        at com.google.android.gms.ads.internal.zzf.<init>(com.google.android.gms:play-services-ads@@19.6.0:24)
        at com.google.android.gms.internal.ads.zzbfh.zzafs(com.google.android.gms:play-services-ads@@19.6.0:10)
        at com.google.android.gms.internal.ads.zzbfm.get(com.google.android.gms:play-services-ads@@19.6.0:6)
        at com.google.android.gms.internal.ads.zzepr.get(com.google.android.gms:play-services-ads@@19.6.0:10)
        at com.google.android.gms.internal.ads.zzcgd.get(com.google.android.gms:play-services-ads@@19.6.0:14)
        at com.google.android.gms.internal.ads.zzepr.get(com.google.android.gms:play-services-ads@@19.6.0:10)
        at com.google.android.gms.internal.ads.zzbfu.get(com.google.android.gms:play-services-ads@@19.6.0:6)
        at com.google.android.gms.internal.ads.zzepr.get(com.google.android.gms:play-services-ads@@19.6.0:10)
        at com.google.android.gms.internal.ads.zzbgb.zzafn(com.google.android.gms:play-services-ads@@19.6.0:198)
        at com.google.android.gms.internal.ads.zzcyn.zza(com.google.android.gms:play-services-ads@@19.6.0:35)
        at com.google.android.gms.internal.ads.zzcyf.zza(com.google.android.gms:play-services-ads@@19.6.0:10)
        at com.google.android.gms.internal.ads.zzcxa.zzb(com.google.android.gms:play-services-ads@@19.6.0:10)
        at com.google.android.gms.ads.AdLoader.zza(com.google.android.gms:play-services-ads-lite@@19.6.0:10)
        at com.google.android.gms.ads.AdLoader.loadAd(com.google.android.gms:play-services-ads-lite@@19.6.0:15)
        at com.ammarahmed.rnadmob.nativeads.RNAdMobUnifiedAdQueueWrapper.loadAds(RNAdMobUnifiedAdQueueWrapper.java:179)
        at com.ammarahmed.rnadmob.nativeads.CacheManager.requestAds(CacheManager.java:97)
        at com.ammarahmed.rnadmob.nativeads.RNAdmobNativeAdsManager.registerRepository(RNAdmobNativeAdsManager.java:83)
        at java.lang.reflect.Method.invoke(Method.java:-2)
        at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372)
        at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:151)
        at com.facebook.react.bridge.queue.NativeRunnable.run(NativeRunnable.java:-2)
        at android.os.Handler.handleCallback(Handler.java:883)
        at android.os.Handler.dispatchMessage(Handler.java:100)
        at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27)
        at android.os.Looper.loop(Looper.java:237)
        at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:226)
        at java.lang.Thread.run(Thread.java:919)

These kinds of errors as my colleague Hamid described started to occur as the version of play-services-ads increased from 19.3.0 to 19.4.0 and above. The most important change in these versions is adding support for Android 11.

Best,
Younes

Mobile Ads SDK Forum Advisor Prod

unread,
Dec 8, 2020, 12:31:34 PM12/8/20
to ha.yo...@gmail.com, google-adm...@googlegroups.com
Hi Younes,

Thank you for the additional information. But I would would like to start by saying that we are able to offer support for AdMob when developing in Android Studio, Xcode and Unity.  With that in mind, we are unable to offer any support for React Native. We would suggest that you contact the React Forums to see if there has been any updates to account for any changes made to play services 19.4 and above. As this would appear to be where the issue is coming from.

Hamid Alaei

unread,
Dec 8, 2020, 1:12:26 PM12/8/20
to Google Mobile Ads SDK Developers
Hello again,
I believe there is a misunderstanding here. It will be the very kind of you if you reconsider our case by carefully reading my argument as followed.

Fact 1. We use Android Studio
Fact 2. You say we are able to offer support when developing Android Studio
Therefore you are able to offer support to us as well.

Can you tell us what is the difference between using Admob alongside React Native or on its own? The exact same stack is reported by other developer here later and you admit it is on your side:
> The team is currently aware of this issue, and is already investigating on this. Rest assured that we'll keep you updated.

So what was the point of delaying the process if it was an issue on your side?

Can you tell me what is the difference between this ticket mentioning ReactNative and a ticket not mentioning ReactNative with the exact same stack-trace? Why do you think if we develop using ReactNative, we are not able to write native Android code using Android Studio? How do you think those amazing ReactNative packages came into existence, other than by the work of Andrion/iOS developers in the community using Android Studio/Xcode?

Here is a quote from reactnative.dev:

> Use a little—or a lot. You can use React Native today in your existing Android and iOS projects or you can create a whole new app from scratch.

If you don't accept this as an issue on your side, we only have to wait for a while to see if others report the same stack again or not.

At the end, I will really thank for your amazing work and support, regardless of any conflicting opinion in this conversation.

Wish you the best.

Mobile Ads SDK Forum Advisor Prod

unread,
Dec 8, 2020, 2:08:28 PM12/8/20
to hami...@gmail.com, google-adm...@googlegroups.com
Hi Hamid,

Although this forum can only support integrating the Mobile Ads SDK into Native apps after looking over your stacktrace it looks like indeed the same trace as in the other thread although in a different form and we thank you for reporting it. 

You are receiving a different trace on version 19.6.0. You are saying that there are issues with "internal" regarding null pointer exceptions. I will bring this up with my team. Although we don't support non native integrations and cannot guarantee support for your use case, if we have a fix we'll inform you.

Regards,

Google Logo
Aryeh Baker
Mobile Ads SDK Team
 


ref:_00D1U1174p._5004Q2789j6:ref

Mobile Ads SDK Forum Advisor

unread,
Jun 16, 2021, 4:19:06 PM6/16/21
to hami...@gmail.com, google-adm...@googlegroups.com
Hi Hamid,

My team has made a fix and all reports show the crash has subsided. Please get back to us if you are still seeing this crash.
Reply all
Reply to author
Forward
0 new messages