Skip to content
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

Latest version 5.4.3 crashes on Android - HeadlessInAppWebView.dispose #1159

Closed
jeromeDms opened this issue Apr 27, 2022 · 23 comments
Closed

Comments

@jeromeDms
Copy link

^5.4.2+1 seems to solve the issue.
But 5.4.3 has the same issue.
Normal ?

Originally posted by @jeromeDms in #1155 (comment)

@github-actions
Copy link

👋 @jeromeDms

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!

@pichillilorenzo
Copy link
Owner

Android Java code of 5.4.2+1 and 5.4.3 is the same.
5.4.3 contains just an update to a class in a .dart file that is not related to native HeadlessInAppWebView.dispose method.
Are you sure the stacktrace is the same?

@pichillilorenzo
Copy link
Owner

pichillilorenzo commented Apr 27, 2022

@jeromeDms just to be sure, could you post here the latest full logs of the crashes? Thanks.
Also, are you sure you are using 5.4.3 and not 5.4.2??

@pichillilorenzo
Copy link
Owner

May be that the crash is happening to someone that still use old version of your app with 5.4.2 plugin version?

@jeromeDms
Copy link
Author

jeromeDms commented Apr 28, 2022

Hi
Thanks for your answer.
It seems the problem did not disappear completely in both 5.4.2+1 and 5.4.3.

Let me summarize below :

My app using 5.4.3 reported a lot of crashes in crashLytics :

Capture d’écran 2022-04-28 à 08 31 30

Stack trace of the first line :

Fatal Exception: java.lang.RuntimeException: Unable to destroy activity {com.amobilefuture.freemobilefree/com.amobilefuture.freemobilefree.MainActivity}: java.util.ConcurrentModificationException
       at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:5567)
       at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:5597)
       at android.app.servertransaction.DestroyActivityItem.execute(DestroyActivityItem.java:44)
       at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:190)
       at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:105)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2386)
       at android.os.Handler.dispatchMessage(Handler.java:107)
       at android.os.Looper.loop(Looper.java:213)
       at android.app.ActivityThread.main(ActivityThread.java:8178)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1101)
Caused by java.util.ConcurrentModificationException
       at java.util.HashMap$HashIterator.nextNode(HashMap.java:1453)
       at java.util.HashMap$ValueIterator.next(HashMap.java:1482)
       at com.pichillilorenzo.flutter_inappwebview.headless_in_app_webview.HeadlessInAppWebViewManager.dispose(HeadlessInAppWebViewManager.java:22)
       at com.pichillilorenzo.flutter_inappwebview.InAppWebViewFlutterPlugin.onDetachedFromEngine(InAppWebViewFlutterPlugin.java:23)
       at io.flutter.embedding.engine.FlutterEngineConnectionRegistry.remove(FlutterEngineConnectionRegistry.java:121)
       at io.flutter.embedding.engine.FlutterEngineConnectionRegistry.remove(FlutterEngineConnectionRegistry.java:16)
       at io.flutter.embedding.engine.FlutterEngineConnectionRegistry.removeAll(FlutterEngineConnectionRegistry.java:11)
       at io.flutter.embedding.engine.FlutterEngineConnectionRegistry.destroy(FlutterEngineConnectionRegistry.java:10)
       at io.flutter.embedding.engine.FlutterEngine.destroy(FlutterEngine.java:31)
       at io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.onDetach(FlutterActivityAndFragmentDelegate.java:98)
       at io.flutter.embedding.android.FlutterFragment.onDetach(FlutterFragment.java:7)
       at androidx.fragment.app.Fragment.performDetach(Fragment.java:6)
       at androidx.fragment.app.FragmentStateManager.detach(FragmentStateManager.java:33)
       at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:235)
       at androidx.fragment.app.SpecialEffectsController$FragmentStateManagerOperation.complete(SpecialEffectsController.java:5)
       at androidx.fragment.app.SpecialEffectsController$Operation.cancel(SpecialEffectsController.java:18)
       at androidx.fragment.app.SpecialEffectsController.forceCompleteAllOperations(SpecialEffectsController.java:215)
       at androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java:36)
       at androidx.fragment.app.FragmentManager.dispatchDestroy(FragmentManager.java:10)
       at androidx.fragment.app.FragmentController.dispatchDestroy(FragmentController.java:4)
       at androidx.fragment.app.FragmentActivity.onDestroy(FragmentActivity.java:5)
       at android.app.Activity.performDestroy(Activity.java:8350)
       at android.app.Instrumentation.callActivityOnDestroy(Instrumentation.java:1348)
       at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:5552)
       at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:5597)
       at android.app.servertransaction.DestroyActivityItem.execute(DestroyActivityItem.java:44)
       at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:190)
       at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:105)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2386)
       at android.os.Handler.dispatchMessage(Handler.java:107)
       at android.os.Looper.loop(Looper.java:213)
       at android.app.ActivityThread.main(ActivityThread.java:8178)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1101)

Seeing those crashes, I urgently released another version using 5.4.2+1 (yesterday) :

Capture d’écran 2022-04-28 à 08 35 15

Stack trace of the first line :

Fatal Exception: java.lang.RuntimeException: Unable to destroy activity {com.amobilefuture.freemobilefree/com.amobilefuture.freemobilefree.MainActivity}: java.util.ConcurrentModificationException
       at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:5235)
       at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:5266)
       at android.app.servertransaction.DestroyActivityItem.execute(DestroyActivityItem.java:44)
       at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176)
       at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2108)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loop(Looper.java:223)
       at android.app.ActivityThread.main(ActivityThread.java:7950)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:603)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)

Caused by java.util.ConcurrentModificationException
       at java.util.HashMap$HashIterator.nextNode(HashMap.java:1441)
       at java.util.HashMap$ValueIterator.next(HashMap.java:1470)
       at com.pichillilorenzo.flutter_inappwebview.headless_in_app_webview.HeadlessInAppWebViewManager.dispose(HeadlessInAppWebViewManager.java:22)
       at com.pichillilorenzo.flutter_inappwebview.InAppWebViewFlutterPlugin.onDetachedFromEngine(InAppWebViewFlutterPlugin.java:23)
       at io.flutter.embedding.engine.FlutterEngineConnectionRegistry.remove(FlutterEngineConnectionRegistry.java:121)
       at io.flutter.embedding.engine.FlutterEngineConnectionRegistry.remove(FlutterEngineConnectionRegistry.java:16)
       at io.flutter.embedding.engine.FlutterEngineConnectionRegistry.removeAll(FlutterEngineConnectionRegistry.java:11)
       at io.flutter.embedding.engine.FlutterEngineConnectionRegistry.destroy(FlutterEngineConnectionRegistry.java:10)
       at io.flutter.embedding.engine.FlutterEngine.destroy(FlutterEngine.java:31)
       at io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.onDetach(FlutterActivityAndFragmentDelegate.java:98)
       at io.flutter.embedding.android.FlutterFragment.onDetach(FlutterFragment.java:7)
       at androidx.fragment.app.Fragment.performDetach(Fragment.java:6)
       at androidx.fragment.app.FragmentStateManager.detach(FragmentStateManager.java:33)
       at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:235)
       at androidx.fragment.app.SpecialEffectsController$FragmentStateManagerOperation.complete(SpecialEffectsController.java:5)
       at androidx.fragment.app.SpecialEffectsController$Operation.cancel(SpecialEffectsController.java:18)
       at androidx.fragment.app.SpecialEffectsController.forceCompleteAllOperations(SpecialEffectsController.java:215)
       at androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java:36)
       at androidx.fragment.app.FragmentManager.dispatchDestroy(FragmentManager.java:10)
       at androidx.fragment.app.FragmentController.dispatchDestroy(FragmentController.java:4)
       at androidx.fragment.app.FragmentActivity.onDestroy(FragmentActivity.java:5)
       at android.app.Activity.performDestroy(Activity.java:8327)
       at android.app.Instrumentation.callActivityOnDestroy(Instrumentation.java:1344)
       at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:5220)
       at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:5266)
       at android.app.servertransaction.DestroyActivityItem.execute(DestroyActivityItem.java:44)
       at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176)
       at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2108)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loop(Looper.java:223)
       at android.app.ActivityThread.main(ActivityThread.java:7950)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:603)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)

The strange thing is that I'm able to reproduce the issue on a real physical device with Android 9 (using 5.4.3), and I'm not able to reproduce the crash on the same device using 5.4.2+1.

All the above crashes are when the app is in the background (reported by crashLytics)

@jeromeDms
Copy link
Author

The other issue I see, not related to .dispose() is the following (maybe you prefer it in another bug report)
The below issue is reported by crashLytics in your latest 5.4.3, as well as the previous version.

Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.amobilefuture.freemobilefree/com.pichillilorenzo.flutter_inappwebview.chrome_custom_tabs.TrustedWebActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.pichillilorenzo.flutter_inappwebview.chrome_custom_tabs.CustomTabActivityHelper.bindCustomTabsService(android.app.Activity)' on a null object reference
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
       at android.app.ActivityThread.-wrap11(ActivityThread.java)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loop(Looper.java:164)
       at android.app.ActivityThread.main(ActivityThread.java:6494)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by java.lang.NullPointerException: Attempt to invoke virtual method 'void com.pichillilorenzo.flutter_inappwebview.chrome_custom_tabs.CustomTabActivityHelper.bindCustomTabsService(android.app.Activity)' on a null object reference
       at com.pichillilorenzo.flutter_inappwebview.chrome_custom_tabs.ChromeCustomTabsActivity.onStart(ChromeCustomTabsActivity.java:5)
       at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1334)
       at android.app.Activity.performStart(Activity.java:7029)
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2741)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
       at android.app.ActivityThread.-wrap11(ActivityThread.java)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loop(Looper.java:164)
       at android.app.ActivityThread.main(ActivityThread.java:6494)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)

@pichillilorenzo
Copy link
Owner

Thanks! These logs should help!

@pichillilorenzo
Copy link
Owner

Released new version 5.4.3+1 with these fixes

@jeromeDms
Copy link
Author

Great. Will test.
What about the last post (other bug) ?

@pichillilorenzo
Copy link
Owner

fixed within the same commit!

@pichillilorenzo
Copy link
Owner

pichillilorenzo commented Apr 28, 2022

From the screenshot, I can see also crashes on InAppBrowserActivity. Could you post the logs, please? Maybe I already fixed it in the same commit!

@jeromeDms
Copy link
Author

Here they are :

InAppBrowserActivity.java line 35

Fatal Exception: java.lang.NullPointerException: Attempt to read from field 'java.lang.Boolean com.pichillilorenzo.flutter_inappwebview.in_app_browser.InAppBrowserOptions.hideUrlBar' on a null object reference
       at com.pichillilorenzo.flutter_inappwebview.in_app_browser.InAppBrowserActivity.onCreateOptionsMenu(InAppBrowserActivity.java:35)
       at android.app.Activity.onCreatePanelMenu(Activity.java:3388)
       at androidx.fragment.app.FragmentActivity.onCreatePanelMenu(FragmentActivity.java:2)
       at androidx.appcompat.view.WindowCallbackWrapper.onCreatePanelMenu(WindowCallbackWrapper.java:2)
       at androidx.appcompat.app.AppCompatDelegateImpl$AppCompatWindowCallback.onCreatePanelMenu(AppCompatDelegateImpl.java:8)
       at androidx.appcompat.app.AppCompatDelegateImpl.preparePanel(AppCompatDelegateImpl.java:125)
       at androidx.appcompat.app.AppCompatDelegateImpl.doInvalidatePanelMenu(AppCompatDelegateImpl.java:61)
       at androidx.appcompat.app.AppCompatDelegateImpl$2.run(AppCompatDelegateImpl.java:22)
       at android.os.Handler.handleCallback(Handler.java:790)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loop(Looper.java:164)
       at android.app.ActivityThread.main(ActivityThread.java:6494)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)

ChromeCustomTabsActivity.java line 5

Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.amobilefuture.freemobilefree/com.pichillilorenzo.flutter_inappwebview.chrome_custom_tabs.TrustedWebActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.pichillilorenzo.flutter_inappwebview.chrome_custom_tabs.CustomTabActivityHelper.bindCustomTabsService(android.app.Activity)' on a null object reference
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
       at android.app.ActivityThread.-wrap11(ActivityThread.java)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loop(Looper.java:164)
       at android.app.ActivityThread.main(ActivityThread.java:6494)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)

Caused by java.lang.NullPointerException: Attempt to invoke virtual method 'void com.pichillilorenzo.flutter_inappwebview.chrome_custom_tabs.CustomTabActivityHelper.bindCustomTabsService(android.app.Activity)' on a null object reference
       at com.pichillilorenzo.flutter_inappwebview.chrome_custom_tabs.ChromeCustomTabsActivity.onStart(ChromeCustomTabsActivity.java:5)
       at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1334)
       at android.app.Activity.performStart(Activity.java:7029)
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2741)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
       at android.app.ActivityThread.-wrap11(ActivityThread.java)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loop(Looper.java:164)
       at android.app.ActivityThread.main(ActivityThread.java:6494)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)

HeadlessInAppWebViewManager.java

Fatal Exception: java.lang.RuntimeException: Unable to destroy activity {com.amobilefuture.freemobilefree/com.amobilefuture.freemobilefree.MainActivity}: java.util.ConcurrentModificationException
       at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:4463)
       at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:4482)
       at android.app.ActivityThread.-wrap6(ActivityThread.java)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1640)
       at android.os.Handler.dispatchMessage(Handler.java:105)
       at android.os.Looper.loop(Looper.java:156)
       at android.app.ActivityThread.main(ActivityThread.java:6617)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:942)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:832)

Caused by java.util.ConcurrentModificationException
       at java.util.HashMap$HashIterator.nextEntry(HashMap.java:860)
       at java.util.HashMap$ValueIterator.next(HashMap.java:888)
       at com.pichillilorenzo.flutter_inappwebview.headless_in_app_webview.HeadlessInAppWebViewManager.dispose(HeadlessInAppWebViewManager.java)
       at com.pichillilorenzo.flutter_inappwebview.InAppWebViewFlutterPlugin.onDetachedFromEngine(InAppWebViewFlutterPlugin.java)
       at io.flutter.embedding.engine.FlutterEngineConnectionRegistry.remove(FlutterEngineConnectionRegistry.java)
       at io.flutter.embedding.engine.FlutterEngineConnectionRegistry.remove(FlutterEngineConnectionRegistry.java)
       at io.flutter.embedding.engine.FlutterEngineConnectionRegistry.removeAll(FlutterEngineConnectionRegistry.java)
       at io.flutter.embedding.engine.FlutterEngineConnectionRegistry.destroy(FlutterEngineConnectionRegistry.java)
       at io.flutter.embedding.engine.FlutterEngine.destroy(FlutterEngine.java)
       at io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.onDetach(FlutterActivityAndFragmentDelegate.java)
       at io.flutter.embedding.android.FlutterFragment.onDetach(FlutterFragment.java)
       at androidx.fragment.app.Fragment.performDetach(Fragment.java)
       at androidx.fragment.app.FragmentStateManager.detach(FragmentStateManager.java)
       at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java)
       at androidx.fragment.app.SpecialEffectsController$FragmentStateManagerOperation.complete(SpecialEffectsController.java)
       at androidx.fragment.app.SpecialEffectsController$Operation.cancel(SpecialEffectsController.java)
       at androidx.fragment.app.SpecialEffectsController.forceCompleteAllOperations(SpecialEffectsController.java)
       at androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java)
       at androidx.fragment.app.FragmentManager.dispatchDestroy(FragmentManager.java)
       at androidx.fragment.app.FragmentController.dispatchDestroy(FragmentController.java)
       at androidx.fragment.app.FragmentActivity.onDestroy(FragmentActivity.java)
       at android.app.Activity.performDestroy(Activity.java:7136)
       at android.app.Instrumentation.callActivityOnDestroy(Instrumentation.java:1158)
       at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:4450)
       at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:4482)
       at android.app.ActivityThread.-wrap6(ActivityThread.java)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1640)
       at android.os.Handler.dispatchMessage(Handler.java:105)
       at android.os.Looper.loop(Looper.java:156)
       at android.app.ActivityThread.main(ActivityThread.java:6617)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:942)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:832)

@jeromeDms
Copy link
Author

I just tested on simulator, Android, and the issue seems still there.
I'm using 5.4.3+1, I cleaned flutter, also invalidated Android studio cache and restarted.

When I press back button on the simulator, the crash occurs with the following logs :

D/AndroidRuntime(31532): Shutting down VM
E/AndroidRuntime(31532): FATAL EXCEPTION: main
E/AndroidRuntime(31532): Process: com.amobilefuture.freemobilefree, PID: 31532
E/AndroidRuntime(31532): java.lang.RuntimeException: Unable to destroy activity {com.amobilefuture.freemobilefree/com.amobilefuture.freemobilefree.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.pichillilorenzo.flutter_inappwebview.headless_in_app_webview.HeadlessInAppWebView.dispose()' on a null object reference
E/AndroidRuntime(31532): 	at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:5111)
E/AndroidRuntime(31532): 	at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:5140)
E/AndroidRuntime(31532): 	at android.app.servertransaction.DestroyActivityItem.execute(DestroyActivityItem.java:44)
E/AndroidRuntime(31532): 	at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176)
E/AndroidRuntime(31532): 	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
E/AndroidRuntime(31532): 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066)
E/AndroidRuntime(31532): 	at android.os.Handler.dispatchMessage(Handler.java:106)
E/AndroidRuntime(31532): 	at android.os.Looper.loop(Looper.java:223)
E/AndroidRuntime(31532): 	at android.app.ActivityThread.main(ActivityThread.java:7656)
E/AndroidRuntime(31532): 	at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(31532): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
E/AndroidRuntime(31532): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
E/AndroidRuntime(31532): Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.pichillilorenzo.flutter_inappwebview.headless_in_app_webview.HeadlessInAppWebView.dispose()' on a null object reference
E/AndroidRuntime(31532): 	at com.pichillilorenzo.flutter_inappwebview.headless_in_app_webview.HeadlessInAppWebViewManager.dispose(HeadlessInAppWebViewManager.java:87)
E/AndroidRuntime(31532): 	at com.pichillilorenzo.flutter_inappwebview.InAppWebViewFlutterPlugin.onDetachedFromEngine(InAppWebViewFlutterPlugin.java:113)
E/AndroidRuntime(31532): 	at io.flutter.embedding.engine.FlutterEngineConnectionRegistry.remove(FlutterEngineConnectionRegistry.java:270)
E/AndroidRuntime(31532): 	at io.flutter.embedding.engine.FlutterEngineConnectionRegistry.remove(FlutterEngineConnectionRegistry.java:280)
E/AndroidRuntime(31532): 	at io.flutter.embedding.engine.FlutterEngineConnectionRegistry.removeAll(FlutterEngineConnectionRegistry.java:288)
E/AndroidRuntime(31532): 	at io.flutter.embedding.engine.FlutterEngineConnectionRegistry.destroy(FlutterEngineConnectionRegistry.java:121)
E/AndroidRuntime(31532): 	at io.flutter.embedding.engine.FlutterEngine.destroy(FlutterEngine.java:425)
E/AndroidRuntime(31532): 	at io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.onDetach(FlutterActivityAndFragmentDelegate.java:699)
E/AndroidRuntime(31532): 	at io.flutter.embedding.android.FlutterFragment.onDetach(FlutterFragment.java:878)
E/AndroidRuntime(31532): 	at androidx.fragment.app.Fragment.performDetach(Fragment.java:3229)
E/AndroidRuntime(31532): 	at androidx.fragment.app.FragmentStateManager.detach(FragmentStateManager.java:812)
E/AndroidRuntime(31532): 	at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:353)
E/AndroidRuntime(31532): 	at androidx.fragment.app.SpecialEffectsController$FragmentStateManagerOperation.complete(SpecialEffectsController.java:745)
E/AndroidRuntime(31532): 	at androidx.fragment.app.SpecialEffectsController$Operation.cancel(SpecialEffectsController.java:597)
E/AndroidRuntime(31532): 	at androidx.fragment.app.SpecialEffectsController.forceCompleteAllOperations(SpecialEffectsController.java:332)
E/AndroidRuntime(31532): 	at androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java:3132)
E/AndroidRuntime(31532): 	at androidx.fragment.app.FragmentManager.dispatchDestroy(FragmentManager.java:3107)
E/AndroidRuntime(31532): 	at androidx.fragment.app.FragmentController.dispatchDestroy(FragmentController.java:334)
E/AndroidRuntime(31532): 	at androidx.fragment.app.FragmentActivity.onDestroy(FragmentActivity.java:330)
E/AndroidRuntime(31532): 	at android.app.Activity.performDestroy(Activity.java:8239)
E/AndroidRuntime(31532): 	at android.app.Instrumentation.callActivityOnDestroy(Instrumentation.java:1344)
E/AndroidRuntime(31532): 	at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:5096)
E/AndroidRuntime(31532): 	... 11 more

@pichillilorenzo
Copy link
Owner

I'm able to replicate the issue, finally! I'm working on it again, sorry! thanks for the reports!

@jeromeDms
Copy link
Author

Thanks to you !

@pichillilorenzo
Copy link
Owner

Released new version 5.4.3+2!

@jeromeDms
Copy link
Author

Great
Testing...

Did you also solve the other bugs I mentioned ?

@pichillilorenzo
Copy link
Owner

Yes, I have added null java checks where needed

@jeromeDms
Copy link
Author

Seems to work !
Congrats and 1000 thanks.

@pichillilorenzo
Copy link
Owner

Thanks to you for your reports!

@pichillilorenzo
Copy link
Owner

@jeromeDms Also, I would be happy if you wanted to add your app to the official Showcase of the plugin 😄

@VladyslavBilomeria
Copy link

@pichillilorenzo
Still getting an error when trying to build an android app with version 5.4.3+2 😔

Running Gradle task 'bundleRelease'...                          
Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
Checking the license for package Android SDK Platform 31 in /usr/local/share/android-sdk/licenses
License for package Android SDK Platform 31 accepted.
Preparing "Install Android SDK Platform 31 (revision: 1)".
"Install Android SDK Platform 31 (revision: 1)" ready.
Installing Android SDK Platform 31 in /usr/local/share/android-sdk/platforms/android-31
"Install Android SDK Platform 31 (revision: 1)" complete.
"Install Android SDK Platform 31 (revision: 1)" finished.
Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
WARNING: [Processor] Library '/Users/vagrant/.gradle/caches/modules-2/files-2.1/com.google.android.exoplayer/extension-mediasession/2.15.1/7ff14fea7bb6e1df9c4624dadb49994561f834ce/extension-mediasession-2.15.1.aar' contains references to both AndroidX and old support library. This seems like the library is partially migrated. Jetifier will try to rewrite the library anyway.
 Example of androidX reference: 'androidx/annotation/Nullable'
 Example of support library reference: 'android/support/v4/media/session/MediaSessionCompat$Callback'
WARNING: [Processor] Library '/Users/vagrant/.gradle/caches/modules-2/files-2.1/androidx.media2/media2-session/1.1.3/27a17d921a5d48327be3c4d25bcea79def4d1f9d/media2-session-1.1.3.aar' contains references to both AndroidX and old support library. This seems like the library is partially migrated. Jetifier will try to rewrite the library anyway.
 Example of androidX reference: 'androidx/media2/session/MediaBrowser$Builder'
 Example of support library reference: 'android/support/v4/media/session/MediaSessionCompat$Token'
WARNING: [Processor] Library '/Users/vagrant/.gradle/caches/modules-2/files-2.1/com.google.android.exoplayer/exoplayer-ui/2.15.1/5af30e03819b04a3c9dc08befd6beca8f2f60f57/exoplayer-ui-2.15.1.aar' contains references to both AndroidX and old support library. This seems like the library is partially migrated. Jetifier will try to rewrite the library anyway.
 Example of androidX reference: 'androidx/core/app/NotificationCompat$Builder'
 Example of support library reference: 'android/support/v4/media/session/MediaSessionCompat$Token'
Note: /Users/vagrant/.pub-cache/hosted/pub.dartlang.org/store_redirect-2.0.1/android/src/main/java/com/danieldallos/storeredirect/StoreRedirectPlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /Users/vagrant/.pub-cache/hosted/pub.dartlang.org/path_provider_android-2.0.11/android/src/main/java/io/flutter/plugins/pathprovider/PathProviderPlugin.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: /Users/vagrant/.pub-cache/hosted/pub.dartlang.org/flutter_secure_storage-4.2.1/android/src/main/java/com/it_nomads/fluttersecurestorage/FlutterSecureStoragePlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /Users/vagrant/.pub-cache/hosted/pub.dartlang.org/flutter_windowmanager-0.2.0/android/src/main/java/io/adaptant/labs/flutter_windowmanager/FlutterWindowManagerPlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /Users/vagrant/.pub-cache/hosted/pub.dartlang.org/local_auth-1.1.11/android/src/main/java/io/flutter/plugins/localauth/LocalAuthPlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
/Users/vagrant/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.4.3+2/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/headless_in_app_webview/HeadlessInAppWebViewManager.java:29: error: package org.jetbrains.annotations does not exist
import org.jetbrains.annotations.NotNull;
                                ^
/Users/vagrant/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.4.3+2/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/headless_in_app_webview/HeadlessInAppWebViewManager.java:55: error: cannot find symbol
  public void onMethodCall(final MethodCall call, @NotNull final Result result) {
                                                   ^
  symbol:   class NotNull
  location: class HeadlessInAppWebViewManager
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
2 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':flutter_inappwebview:compileReleaseJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org/
BUILD FAILED in 9m 48s
Running Gradle task 'bundleRelease'...                            591.5s
Gradle task bundleRelease failed with exit code 1
Run: failed to build Android app: exit status 1

Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants