-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🔥 [V6] Admob crash on Android 9 - SkSurface::getCanvas() #2935
Comments
This is strange - we don't actually use any sort of webview in AdMob, we pass a RN View into native and it injects an internal ad into the View. What sort of ad are you displaying? Are you also using |
If I understand Android crashes from WebViews correctly they are almost not fixable and the Chrome team is almost not responsive (I'm sure they are working, they just don't discuss their status on their bug tracker 🤷♂️ ) - and in my pure-native-Android app I have a crash that people using AdMob also experience so I have seen threads where they indicate AdMob internally uses a Chrome WebView to display the ads, and sometimes it crashes. Which is all to say: If I understand things correctly AdMob can fire up a Chrome WebView without your doing anything, and that thing can crash. Whether that's useful or not, I'm not sure. Here is an example: https://github.com/mopub/mopub-android-sdk/issues/312 - and the action there would be to make sure you hook onRenderProcessGone in all your webviews I suppose, because you never know what a creative will do in Chrome and it might crash... Looks like if people use react-native-webview at the same time, their webview subclass does not override onRenderProcessGone, so you'll be liable for full app crashes if an AdMob WebView crashes due to bad creative + webview bug, even if AdMob and your ad network have done the correct thing: https://github.com/react-native-community/react-native-webview/blob/master/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java#L971 I see no PR or issue open or closed with that string, so maybe it's unknown to react-native-webview, and you might try hacking it in with a System.err real quick in the java code for react-native-webview in node_modules to override onLowMemory and onRenderProcess gone to see if those are triggering somehow, as a start to fixing it https://github.com/react-native-community/react-native-webview/issues?utf8=%E2%9C%93&q=+onrenderprocessgone I will quickly add this may have nothing to do with anything, and you may see nothing in your log results but if you can reproduce it locally it's a quick way to at least confirm that's not your issue |
Yes I thought about the web view because I have sometimes some bug mentioning "com.google.android.gms.ads.internal.webview" Like I'm using react-native-navigation It could be also a problem combining it with webviews like mentionned here : react-native-webview/react-native-webview#575 (comment) Removing the animation when pushing a screen seems to be a solution. It's seems the ads on Admob on RN Firebase V6 aren't loading the same way than V5 (faster?) |
@mikehardy if I understand well what you said (sorry my English is far from good) using react-native-webview at the same time of Admob Ads with webview could be a problem ? But still I don't understand why this error never show up on V5 |
@manuhook no problem - my wife tells me my English is not very good either (it is my mother tongue 😅 ) What I was saying is it might be a secondary problem. The primary problem is that some Ad content is crashing a webview. This is a problem for years and comes and goes depending on WebView version and AdMob SDK internal behavior (which is different between v5 and v6 I think) and Android API etc etc. So even if all current bugs are fixed it can happen again. then if it happens I think react-native-webview is unprotected as it does not hook onRenderProcessGone, so if you have a react-native-webview in your app and an Ad blows up it's Chrome WebView, your whole app goes down. If all the other WebView users in your app hook onRenderProcessGone correctly and handle it gracefully, then even an Ad that blows up Chrome won't take the app down. That's the goal I think. |
Ok thank you 🙏 I will try to remove react-native-webview to see if it's help. |
After some digging, here what I found :
On Android 9 I've found a way to reproduce the error using a webview : Sometimes on V6 Admob is rendering an ad through a webview and at some point, the width or the height of this webview is equal to 0. and it's producing the crash. This code is maybe be the responsible for the bug on the first render : Line 26 Line 30 Line 79
(my banner size is not FLUID, I'm using custom height and width like "400x250") Is it possible to have the style (width and height) always defined by props.style like on V5 ? Thanks a lot ! |
I'm going to try with size "FLUID" and props.style to see if it's better. |
To follow up with the issue : the cause of the bug is confirmed, it is indeed admob which displays sometimes a webview without height or width (or equal to 0) causing the crash. Another case here : I will try a patch without initializing ad's height and width with 0 on the first render like it is now on /admob/lib/ads/BannerAd.js |
Hello 👋, to help manage issues we automatically close stale issues.
|
Closing this issue after a prolonged period of inactivity. If this is still present in the latest release, please feel free to create a new issue with up-to-date information. |
If having issue with react-native-webview check this comment webview#575 |
@zuhairnaqi why are you posting in an issue that was closed as stale more than a year ago? That seems odd. |
Issue
Since we've upgrade Admob from v5 to V6 we are having a lot of crash only on Android 9 :
It's seems it's linked to the webview when an ad is displayed.
react-native-webview/react-native-webview#623
react-native-webview/react-native-webview#575
A solution mentionned there would be to disable hardware acceleration on webviews.
Is it possible ?
Any ideas why we didn't have this problem on V5 ?
On V6 and V5 we are using the same SDK com.google.firebase:firebase-ads:18.3.0
Thank you !
Project Files
Android
Click To Expand
Have you converted to AndroidX?
android/gradle.settings
jetifier=true
for Android compatibility?jetifier
for react-native compatibility?android/build.gradle
:android/app/build.gradle
:// N/A
android/settings.gradle
:// N/A
MainApplication.java
:// N/A
AndroidManifest.xml
:<!-- N/A -->
Environment
Click To Expand
react-native info
output:react-native-firebase
version you're using that has this issue:"@react-native-firebase/admob": "^6.0.4",
"@react-native-firebase/analytics": "^6.0.4",
"@react-native-firebase/app": "^6.0.4",
"@react-native-firebase/crashlytics": "^6.0.4",
Firebase
module(s) you're using that has the issue:"@react-native-firebase/admob": "^6.0.4",
TypeScript
?N
The text was updated successfully, but these errors were encountered: