Reputation: 129
I was getting below crash in Android Webview. I tried to load the webview for the functionality within the app and got this crash. Please advise on it.
It's crashing on Android 13 (Samsung S21). Note: It is not crashing in Google Pixel (which has Android 13). Tried updating the Webview. Didn't work.
FATAL EXCEPTION: main
Process: com.app.au, PID: 15769
java.lang.NullPointerException: Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference
at Ar.run(chromium-TrichromeWebViewGoogle6432.aab-stable-573519633:50)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:335)
at android.os.Looper.loopOnce(Looper.java:186)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8757)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)
Thanks
Upvotes: 1
Views: 1097
Reputation: 11
https://stackoverflow.com/a/47188573 worked for me
webChromeClient = object : WebChromeClient() {
override fun getDefaultVideoPoster(): Bitmap? {
return super.getDefaultVideoPoster()
?: Bitmap.createBitmap(1, 1, Bitmap.Config.ALPHA_8)
}
}
Upvotes: 1