pichillilorenzo / flutter_inappwebview

A Flutter plugin that allows you to add an inline webview, to use a headless webview, and to open an in-app browser window.
https://inappwebview.dev
Apache License 2.0
3.17k stars 1.53k forks source link

Android Firebase issue: PlatformViewWrapper.draw - java.lang.IllegalStateException - Surface was already locked! - PlatformViewWrapper.java:300 #1855

Open HAFIZkhan-source opened 10 months ago

HAFIZkhan-source commented 10 months ago

Environment

Technology Version
Flutter version 3.7.12
Plugin version 5.8.0
Android version 6, 11, 12, 13
iOS version
macOS version
Xcode version

Device information: Samsung Galaxy J2 Pro, vivo, Xiomi

Stacktrace/Logcat

Fatal Exception: java.lang.IllegalStateException: Surface was already locked! at android.view.Surface$HwuiContext.lockCanvas(Surface.java:648) at android.view.Surface.lockHardwareCanvas(Surface.java:365) at io.flutter.plugin.platform.PlatformViewWrapper.draw(PlatformViewWrapper.java:300) at android.view.View.updateDisplayListIfDirty(View.java:16519) at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3910) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3890) at android.view.View.updateDisplayListIfDirty(View.java:16479) at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3910) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3890) at android.view.View.updateDisplayListIfDirty(View.java:16479) at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3910) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3890) at android.view.View.updateDisplayListIfDirty(View.java:16479) at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3910) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3890) at android.view.View.updateDisplayListIfDirty(View.java:16479) at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3910) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3890) at android.view.View.updateDisplayListIfDirty(View.java:16479) at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:325) at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:331) at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:366) at android.view.ViewRootImpl.draw(ViewRootImpl.java:3234) at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:3033) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2615) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1528) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7530) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:911) at android.view.Choreographer.doCallbacks(Choreographer.java:686) at android.view.Choreographer.doFrame(Choreographer.java:622) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:897) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:7325) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)

java.lang.ProcessManager: at java.lang.Object.wait(Object.java) at java.lang.ProcessManager.waitForMoreChildren(ProcessManager.java:140) at java.lang.ProcessManager.watchChildren(ProcessManager.java:105) at java.lang.ProcessManager.-wrap0(ProcessManager.java) at java.lang.ProcessManager$1.run(ProcessManager.java:58)

pool-21-thread-1: at java.lang.Object.wait(Object.java) at java.lang.Thread.parkFor$(Thread.java:1220) at sun.misc.Unsafe.park(Unsafe.java:299) at java.util.concurrent.locks.LockSupport.park(LockSupport.java:158) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2013) at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1078) at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1071) at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1038) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1098) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) at java.lang.Thread.run(Thread.java:818)

ReferenceQueueDaemon: at java.lang.Object.wait(Object.java) at java.lang.Daemons$ReferenceQueueDaemon.run(Daemons.java:162) at java.lang.Thread.run(Thread.java:818)

AsyncTask #3: at java.lang.Object.wait(Object.java) at java.lang.Thread.parkFor$(Thread.java:1220) at sun.misc.Unsafe.park(Unsafe.java:299) at java.util.concurrent.locks.LockSupport.park(LockSupport.java:158) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2013) at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:410) at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1038) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1098) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) at java.lang.Thread.run(Thread.java:818)

PlatformServiceBridgeHandlerThread: at android.os.MessageQueue.nativePollOnce(MessageQueue.java) at android.os.MessageQueue.next(MessageQueue.java:323) at android.os.Looper.loop(Looper.java:135) at android.os.HandlerThread.run(HandlerThread.java:61)

OkHttp TaskRunner: at java.lang.Object.wait(Object.java) at okhttp3.internal.concurrent.TaskRunner$RealBackend.coordinatorWait(TaskRunner.kt:294) at okhttp3.internal.concurrent.TaskRunner.awaitTaskToRun(TaskRunner.kt:218) at okhttp3.internal.concurrent.TaskRunner$runnable$1.run(TaskRunner.kt:59) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) at java.lang.Thread.run(Thread.java:818)

github-actions[bot] commented 10 months ago

👋 @HAFIZkhan-source

NOTE: This comment is auto-generated.

Are you sure you have already searched for the same problem?

Some people open new issues but they didn't search for something similar or for the same issue. Please, search for it using the GitHub issue search box or on the official inappwebview.dev website, or, also, using Google, StackOverflow, etc. before posting a new one. You may already find an answer to your problem!

If this is really a new issue, then thank you for raising it. I will investigate it and get back to you as soon as possible. Please, make sure you have given me as much context as possible! Also, if you didn't already, post a code example that can replicate this issue.

In the meantime, you can already search for some possible solutions online! Because this plugin uses native WebView, you can search online for the same issue adding android WebView [MY ERROR HERE] or ios WKWebView [MY ERROR HERE] keywords.

Following these steps can save you, me, and other people a lot of time, thanks!

HAFIZkhan-source commented 10 months ago

Yes, I have searched and then submitted the issue

HAFIZkhan-source commented 7 months ago

Any update on this?

Please see this on priority. Many app users are facing this issue

pichillilorenzo commented 7 months ago

Have you tried to upgrade Flutter version and the plugin version to 6?

viktor-savchik-idf commented 4 months ago

@pichillilorenzo we have the same issue it is top 1 of our crashes in the app and yes we updated the plugin version to 6 and using the new version of Flutter