flutter_inappwebview
flutter_inappwebview copied to clipboard
ANR issue in production android app
- [yes] I have read the Get Started - Installation section
- [yes] I have read and done the Get Started - Setup Android section
- [yes] I have read and done the Get Started - Setup iOS section
- [yes] I have already searched for the same problem
Environment
Technology | Version |
---|---|
Flutter version | 2.2.2 |
Plugin version | 5.3.2 |
Android version | 10 |
iOS version | NA |
Xcode version | NA |
Device information:
Android Device: Android 10 (SDK 29) Sony Xperia XZ3
Description
During launch of the app, it will only show a white screen. This is happening in production and was reported by users. Only work around is to restart the app. I cannot reproduce this on my end.
I cannot repro it on my end so I looked at the Playstore Vital Reports.
Expected behavior:
No ANR No whitescreen.
Current behavior: White screen only during app start. ANR is happening
Steps to reproduce
- Open the app
- It will not go through
- Will only show whitescreen
Images
Stacktrace/Logcat
trace below:
#00 pc 0000000001a00674 /data/app/com.google.android.webview-NX370BtKX9xVdllmWZwsEQ==/base.apk!libmonochrome.so (???)
#00 pc 00000000024025e0 /data/app/com.google.android.webview-NX370BtKX9xVdllmWZwsEQ==/base.apk!libmonochrome.so (???)
#00 pc 0000000002103f70 /data/app/com.google.android.webview-NX370BtKX9xVdllmWZwsEQ==/base.apk!libmonochrome.so (???)
#00 pc 0000000002106374 /data/app/com.google.android.webview-NX370BtKX9xVdllmWZwsEQ==/base.apk!libmonochrome.so (???)
#00 pc 00000000017b7af0 /data/app/com.google.android.webview-NX370BtKX9xVdllmWZwsEQ==/base.apk!libmonochrome.so (???)
#00 pc 0000000002e10cf0 /data/app/com.google.android.webview-NX370BtKX9xVdllmWZwsEQ==/base.apk!libmonochrome.so (???)
#00 pc 0000000002e10ad4 /data/app/com.google.android.webview-NX370BtKX9xVdllmWZwsEQ==/base.apk!libmonochrome.so (???)
#00 pc 0000000002e0f4ec /data/app/com.google.android.webview-NX370BtKX9xVdllmWZwsEQ==/base.apk!libmonochrome.so (???)
#00 pc 0000000002e100ac /data/app/com.google.android.webview-NX370BtKX9xVdllmWZwsEQ==/base.apk!libmonochrome.so (Java_J_N_M1Y_1XVCN+120)
at J.N.M1Y_XVCN (Native method)
at org.chromium.content.browser.BrowserStartupControllerImpl.a (chromium-TrichromeWebViewGoogle.aab-stable-463807433)
at org.chromium.content.browser.BrowserStartupControllerImpl.g (chromium-TrichromeWebViewGoogle.aab-stable-463807433)
at C8.run (chromium-TrichromeWebViewGoogle.aab-stable-463807433)
at org.chromium.base.ThreadUtils.f (chromium-TrichromeWebViewGoogle.aab-stable-463807433)
at TA0.g (chromium-TrichromeWebViewGoogle.aab-stable-463807433)
at TA0.b (chromium-TrichromeWebViewGoogle.aab-stable-463807433)
at com.android.webview.chromium.WebViewChromiumFactoryProvider.getWebStorage (chromium-TrichromeWebViewGoogle.aab-stable-463807433)
at android.webkit.WebStorage.getInstance (WebStorage.java:194)
at com.pichillilorenzo.flutter_inappwebview.MyWebStorage.<init> (MyWebStorage.java:29)
at com.pichillilorenzo.flutter_inappwebview.InAppWebViewFlutterPlugin.onAttachedToEngine (InAppWebViewFlutterPlugin.java:89)
at com.pichillilorenzo.flutter_inappwebview.InAppWebViewFlutterPlugin.onAttachedToEngine (InAppWebViewFlutterPlugin.java:68)
at io.flutter.embedding.engine.FlutterEngineConnectionRegistry.add (FlutterEngineConnectionRegistry.java:143)
at io.flutter.plugins.GeneratedPluginRegistrant.registerWith (GeneratedPluginRegistrant.java:24)
at java.lang.reflect.Method.invoke (Native method)
at io.flutter.embedding.engine.FlutterEngine.registerPlugins (FlutterEngine.java:414)
at io.flutter.embedding.engine.FlutterEngine.<init> (FlutterEngine.java:345)
at io.flutter.embedding.engine.FlutterEngine.<init> (FlutterEngine.java:260)
at io.flutter.embedding.engine.FlutterEngine.<init> (FlutterEngine.java:240)
at io.flutter.embedding.engine.FlutterEngine.<init> (FlutterEngine.java:160)
at io.flutter.embedding.engine.FlutterEngine.<init> (FlutterEngine.java:151)
at com.ryanheise.audioservice.AudioServicePlugin.getFlutterEngine (AudioServicePlugin.java:68)
at com.ryanheise.audioservice.AudioService.onCreate (AudioService.java:286)
at android.app.ActivityThread.handleCreateService (ActivityThread.java:4273)
at android.app.ActivityThread.access$1900 (ActivityThread.java:239)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2029)
at android.os.Handler.dispatchMessage (Handler.java:107)
at android.os.Looper.loop (Looper.java:214)
at android.app.ActivityThread.main (ActivityThread.java:7899)
at java.lang.reflect.Method.invoke (Native method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:960)
#855
๐ @marcqtan
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!
same issue
Me too.๐ I'm looking for a solution.
@Gurvinder963 @marcqtan
I have a question for you both.
What are the circumstances when this error occurs?
I noticed this error during a replacement update from TWA to Flutter. Are you two in a situation where you are doing replacements, etc. from TWA? Or have you been a Flutter project from the beginning?
thanks๐
Also, the error I am experiencing with you guys is slightly different from my app.
However, I am experiencing ANR as well.
at Tf0.setServiceWorkerClient (chromium-TrichromeWebViewGoogle.aab-stable-489607933:58)
at androidx.webkit.internal.ServiceWorkerControllerImpl.setServiceWorkerClient (ServiceWorkerControllerImpl.java:88)
at com.pichillilorenzo.flutter_inappwebview.ServiceWorkerManager.<init> (ServiceWorkerManager.java:41)
at com.pichillilorenzo.flutter_inappwebview.InAppWebViewFlutterPlugin.onAttachedToEngine (InAppWebViewFlutterPlugin.java:91)
at com.pichillilorenzo.flutter_inappwebview.InAppWebViewFlutterPlugin.onAttachedToEngine (InAppWebViewFlutterPlugin.java:68)
at io.flutter.embedding.engine.FlutterEngineConnectionRegistry.add (FlutterEngineConnectionRegistry.java:145)
at io.flutter.plugins.GeneratedPluginRegistrant.registerWith (GeneratedPluginRegistrant.java:104)
at java.lang.reflect.Method.invoke (Native method)
at io.flutter.embedding.engine.plugins.util.GeneratedPluginRegister.registerGeneratedPlugins (GeneratedPluginRegister.java:80)
at io.flutter.embedding.engine.FlutterEngine.<init> (FlutterEngine.java:355)
at io.flutter.embedding.engine.FlutterEngine.<init> (FlutterEngine.java:263)
at io.flutter.embedding.engine.FlutterEngine.<init> (FlutterEngine.java:243)
at io.flutter.embedding.engine.FlutterEngine.<init> (FlutterEngine.java:163)
at io.flutter.embedding.engine.FlutterEngine.<init> (FlutterEngine.java:154)
at com.ryanheise.audioservice.AudioServicePlugin.getFlutterEngine (AudioServicePlugin.java:73)
at jp.winticket.app.MainActivity.provideFlutterEngine (MainActivity.kt:10)
at io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.setupFlutterEngine (FlutterActivityAndFragmentDelegate.java:248)
at io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.onAttach (FlutterActivityAndFragmentDelegate.java:174)
at io.flutter.embedding.android.FlutterActivity.onCreate (FlutterActivity.java:459)
at android.app.Activity.performCreate (Activity.java:8207)
at android.app.Activity.performCreate (Activity.java:8191)
at android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1309)
at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:3819)
at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:4022)
at android.app.servertransaction.LaunchActivityItem.execute (LaunchActivityItem.java:85)
at android.app.servertransaction.TransactionExecutor.executeCallbacks (TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2336)
at android.os.Handler.dispatchMessage (Handler.java:106)
at android.os.Looper.loop (Looper.java:246)
at android.app.ActivityThread.main (ActivityThread.java:8653)
at java.lang.reflect.Method.invoke (Native method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:602)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1130)
Hi,
flutter_inappwebview version - 4.0.0+4 Flutter - 1.22.5 Dart - 2.10.4
App is crashing while uploading app bundle on play store. It's crashing on Android 10 nd above.
But it's working fine in release apk. But now we can't upload apk on play store.
On Fri, 15 Apr, 2022, 7:55 am Yoko, @.***> wrote:
@Gurvinder963 https://github.com/Gurvinder963 @marcqtan https://github.com/marcqtan
I have a question for you both.
What are the circumstances when this error occurs?
I noticed this error during a replacement update from TWA to Flutter. Are you two in a situation where you are doing replacements, etc. from TWA? Or have you been a Flutter project from the beginning?
thanks๐
โ Reply to this email directly, view it on GitHub https://github.com/pichillilorenzo/flutter_inappwebview/issues/1032#issuecomment-1099791927, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEFE7L3LVVPKCD2QNYAJRYLVFDHPRANCNFSM5IDIW5GQ . You are receiving this because you were mentioned.Message ID: @.***>
Sorry, I still don't understand your statement.
Are you saying that the problem did not occur with the apk, but with the app bundle?
Another thing I'd like to ask is. Are you sure you are not replacing your TWA Android app with Flutter?
Hi,
Yes, problem did not occur with the apk, but with the app bundle? Crashing in Android 10 and above.
I had not convert TWA to flutter. I created fresh flutter project.
I think I need to add
ndk.abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64:
I think plugin has native library so i have add above line .
flutter_youtube_player also crashing. I think it's using ur plugin internally.
On Sat, 16 Apr, 2022, 9:29 am Yoko, @.***> wrote:
Sorry, I still don't understand your statement.
Are you saying that the problem did not occur with the apk, but with the app bundle?
Another thing I'd like to ask is. Are you sure you are not replacing your TWA Android app with Flutter?
โ Reply to this email directly, view it on GitHub https://github.com/pichillilorenzo/flutter_inappwebview/issues/1032#issuecomment-1100559482, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEFE7L2R5A62EMXEL25BLLTVFI3LZANCNFSM5IDIW5GQ . You are receiving this because you were mentioned.Message ID: @.***>
https://github.com/pichillilorenzo/flutter_inappwebview/issues/1146#issue-1205705003
Sorry for the late reply.
Perhaps you are mistaken. The problem that occurred was a crash, right? I am experiencing ANR, not crashes.
Hi,
Yes crash is happening on Android 11 when I target sdk 30 . Other wise it was working fine on target sdk 29.
flutter_inappwebview version - 4.0.0+4 Flutter - 1.22.5 Dart - 2.10.4
Should I have to update plugin?
On Mon, 18 Apr, 2022, 6:37 am Yoko, @.***> wrote:
#1146 (comment) https://github.com/pichillilorenzo/flutter_inappwebview/issues/1146#issue-1205705003
Sorry for the late reply.
Perhaps you are mistaken. The problem that occurred was a crash, right? I am experiencing ANR, not crashes.
โ Reply to this email directly, view it on GitHub https://github.com/pichillilorenzo/flutter_inappwebview/issues/1032#issuecomment-1100995859, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEFE7L45YWY4BWSGM72XJS3VFSYTNANCNFSM5IDIW5GQ . You are receiving this because you were mentioned.Message ID: @.***>
I don't know what to do.
I have moved to webview_flutter
which is the problem and does not use ServiceWorker.
@Yokoi-K how are you using the service worker controller? can you post the piece of code on how you initialize and use it? Also, post the full error stacktrace please
No, we do not use ServiceWorker. I did not need it for my application. However, as you can see in this stack trace, there was an error in the ServiceWorker init. https://github.com/pichillilorenzo/flutter_inappwebview/issues/1032#issuecomment-1099793773
So I moved to webview_flutter
which does not use service worker.
However, this plugin was excellent and I would use it again if this error is fixed.
@Yokoi-K that stacktrace is not full. Could you provide full stacktrace from the start please?
Sorry, that stack trace is all there is. It is ANR, so there is no specific error statement.
Ok, maybe I know how to fix that error
@Yokoi-K I have uploaded the new version 5.4.0+3
that should not call setServiceWorkerClient
method (that is the method that causes the error) if you are not using the Service Worker Controller in your Android app.
Thank you!๐ The fixes were so fast, you're so good!
I will share this with my team.
Hi @pichillilorenzo
We also have the same problem and here is the stack trace from the PlayConsole:
#00 pc 000000000007f33c /apex/com.android.runtime/lib64/bionic/libc.so (syscall+28)
#00 pc 000000000014b094 /apex/com.android.runtime/lib64/libart.so (art::ConditionVariable::WaitHoldingLocks(art::Thread*)+148)
#00 pc 00000000003b5940 /apex/com.android.runtime/lib64/libart.so (art::JNI::CallStaticIntMethodV(_JNIEnv*, _jclass*, _jmethodID*, std::__va_list)+464)
#00 pc 000000000354feb8 /data/app/com.google.android.webview--HMnghXDiUONnImlzY2YfQ==/base.apk!libmonochrome.so (???)
at J.N.M1Y_XVCN (Native method)
at org.chromium.content.browser.BrowserStartupControllerImpl.a (chromium-TrichromeWebViewGoogle.aab-stable-495106133:2377)
at org.chromium.content.browser.BrowserStartupControllerImpl.f (chromium-TrichromeWebViewGoogle.aab-stable-495106133:256)
at z8.run (chromium-TrichromeWebViewGoogle.aab-stable-495106133:168)
at org.chromium.base.ThreadUtils.e (chromium-TrichromeWebViewGoogle.aab-stable-495106133:137)
at org.chromium.android_webview.AwBrowserProcess.j (chromium-TrichromeWebViewGoogle.aab-stable-495106133:146)
at com.android.webview.chromium.b1.d (chromium-TrichromeWebViewGoogle.aab-stable-495106133:228)
at com.android.webview.chromium.b1.b (chromium-TrichromeWebViewGoogle.aab-stable-495106133:347)
at com.android.webview.chromium.WebViewChromiumFactoryProvider.getWebStorage (chromium-TrichromeWebViewGoogle.aab-stable-495106133:504)
at android.webkit.WebStorage.getInstance (WebStorage.java:194)
at com.pichillilorenzo.flutter_inappwebview.MyWebStorage.<init> (MyWebStorage.java:29)
at com.pichillilorenzo.flutter_inappwebview.InAppWebViewFlutterPlugin.onAttachedToEngine (InAppWebViewFlutterPlugin.java:92)
at com.pichillilorenzo.flutter_inappwebview.InAppWebViewFlutterPlugin.onAttachedToEngine (InAppWebViewFlutterPlugin.java:71)
at io.flutter.embedding.engine.FlutterEngineConnectionRegistry.add (FlutterEngineConnectionRegistry.java:145)
at io.flutter.plugins.GeneratedPluginRegistrant.registerWith (GeneratedPluginRegistrant.java:104)
at java.lang.reflect.Method.invoke (Native method)
at io.flutter.embedding.engine.plugins.util.GeneratedPluginRegister.registerGeneratedPlugins (GeneratedPluginRegister.java:80)
at io.flutter.embedding.engine.FlutterEngine.<init> (FlutterEngine.java:355)
at io.flutter.embedding.engine.FlutterEngine.<init> (FlutterEngine.java:263)
at io.flutter.embedding.engine.FlutterEngine.<init> (FlutterEngine.java:243)
at io.flutter.embedding.engine.FlutterEngine.<init> (FlutterEngine.java:163)
at io.flutter.embedding.engine.FlutterEngine.<init> (FlutterEngine.java:154)
at com.ryanheise.audioservice.AudioServicePlugin.getFlutterEngine (AudioServicePlugin.java:73)
at com.ryanheise.audioservice.AudioService.onCreate (AudioService.java:282)
at android.app.ActivityThread.handleCreateService (ActivityThread.java:3981)
at android.app.ActivityThread.access$1600 (ActivityThread.java:226)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1900)
at android.os.Handler.dispatchMessage (Handler.java:107)
at android.os.Looper.loop (Looper.java:214)
at android.app.ActivityThread.main (ActivityThread.java:7386)
at java.lang.reflect.Method.invoke (Native method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:980)
I am not sure, but it seems this ANR only happens at application startup.
Can we try not to instantiate the WebStorage
at the MyWebStorage
constructor, but lazily instantiate it?
https://github.com/pichillilorenzo/flutter_inappwebview/blob/ee1b0d7ff754a49e9f995c68505da3556b9c830d/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/MyWebStorage.java#L29
Hi @pichillilorenzo - As mentioned by @lcdsmao, we are also facing the same ANR issue
Hi @pichillilorenzo, FYI - mentioned by @lcdsmao, we are also facing the same issue,
Hi @pichillilorenzo, do we have any update on this?
Hi @mohanK22 , have you tried to add this in the Manifest? 'android.permission.INTERNET' I have added the permission and problem solved
Hi @nickrivers, The 'android.permission.INTERNET' permission is there in the manifest file which was added long back.
any news in this?