You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Inappwebview crashes when i call controller.setSettings on android with a Platformexception. (See more details in the Stacktrace section)
I tested it with Android 14 and Android 11, flutter_inappwebview ^6.2.0-beta.2 and flutter_inappwebview ^6.1.5
The appended minimal reproducible example throws an unhandled exception, but the webview seems to work afterwards, so make sure to break on uncaught exceptions.
My real application does not work after this exception is thrown.
Expected Behavior
The plugin should not crash on android when calling setSettings
Steps with code example to reproduce
Steps with code example to reproduce
Here is a minimal reproducible example:
This is just a new created flutter app with the added Internet permission, flutter_inappwebview: ^6.1.5 dependency and following main.dart code:
PlatformException (PlatformException(error, Attempt to invoke virtual method 'boolean java.lang.Integer.equals(java.lang.Object)' on a null object reference, null, java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.Integer.equals(java.lang.Object)' on a null object reference
at com.pichillilorenzo.flutter_inappwebview_android.webview.in_app_webview.InAppWebView.setSettings(InAppWebView.java:1005)
at com.pichillilorenzo.flutter_inappwebview_android.webview.WebViewChannelDelegate.onMethodCall(WebViewChannelDelegate.java:229)
at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:267)
at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:292)
at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:319)
at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12)
at android.os.Handler.handleCallback(Handler.java:958)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:224)
at android.os.Looper.loop(Looper.java:318)
at android.app.ActivityThread.main(ActivityThread.java:8790)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:561)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1013)
))
Flutter Doctor output:
flutter doctor -v
[√] Flutter (Channel stable, 3.27.0, on Microsoft Windows [Version 10.0.26100.2605], locale de-AT)
• Flutter version 3.27.0 on channel stable at ...
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 8495dee1fd (5 weeks ago), 2024-12-10 14:23:39 -0800
• Engine revision 83bacfc525
• Dart version 3.6.0
• DevTools version 2.40.2
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at C:\Users\GabrielLugmayr\AppData\Local\Android\Sdk
• Platform android-35, build-tools 34.0.0
• ANDROID_HOME = C:\Users\GabrielLugmayr\AppData\Local\Android\Sdk
• Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
• Java version OpenJDK Runtime Environment (build 17.0.9+0--11185874)
• All Android licenses accepted.
[√] Android Studio (version 2023.2)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 17.0.9+0--11185874)
[√] VS Code (version 1.96.2)
• VS Code at C:\Users\GabrielLugmayr\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.102.0
[√] Connected device (2 available)
• 24069PC21G (mobile) • 2e2b5286 • android-arm64 • Android 14 (API 34)
• sdk gphone64 x86 64 (mobile) • emulator-5554 • android-x64 • Android 14 (API 34) (emulator)
[√] Network resources
• All expected network resources are available.
• No issues found!
Flutter version
3.27.0
Operating System, Device-specific and/or Tool
Tested with Android API level 34 (real device + emulator) , 30 (real device)
For the rest see the flutter doctor output in the stacktrace/logs section
Plugin version
^6.2.0-beta.2, flutter_inappwebview ^6.1.5
Additional information
No response
Self grab
I'm ready to work on this issue!
The text was updated successfully, but these errors were encountered:
if (newSettingsMap.get("forceDark") != null && !customSettings.forceDark.equals(newCustomSettings.forceDark)) {
customSettings.forceDark is abandoned I think, it's null. But getSettings will give you a non-null value so newSettingsMap.get("forceDark") != null is always true. And this line is executed without null check.
@laishere thanks for your quick reply!
Yes, as shown in the example I call setSettings with updated settings from getSettings
Thanks for your solutions, fortunately I only use it to set isInspectible to true on debug builds, so it's not a huge problem for me.
However, generally I think it would be good if one could rely on that calling setSettings with the result of getSettings will lead to no issues.
Is there an existing issue for this?
Current Behavior
The Inappwebview crashes when i call
controller.setSettings
on android with a Platformexception. (See more details in the Stacktrace section)I tested it with Android 14 and Android 11, flutter_inappwebview ^6.2.0-beta.2 and flutter_inappwebview ^6.1.5
The appended minimal reproducible example throws an unhandled exception, but the webview seems to work afterwards, so make sure to break on uncaught exceptions.
My real application does not work after this exception is thrown.
Expected Behavior
The plugin should not crash on android when calling setSettings
Steps with code example to reproduce
Steps with code example to reproduce
Here is a minimal reproducible example:
This is just a new created flutter app with the added Internet permission, flutter_inappwebview: ^6.1.5 dependency and following main.dart code:
Stacktrace/Logs
Stacktrace/Logs
Flutter Doctor output:
Flutter version
3.27.0
Operating System, Device-specific and/or Tool
Tested with Android API level 34 (real device + emulator) , 30 (real device)
For the rest see the flutter doctor output in the stacktrace/logs section
Plugin version
^6.2.0-beta.2, flutter_inappwebview ^6.1.5
Additional information
No response
Self grab
The text was updated successfully, but these errors were encountered: