flutter_inappwebview
flutter_inappwebview copied to clipboard
fix: Add missing proguard rule for BackEvent
Connection with issue(s)
Fixes https://github.com/pichillilorenzo/flutter_inappwebview/issues/2178
Related: https://github.com/pichillilorenzo/flutter_inappwebview/pull/2189, but that PR makes changes to all sub-packages.
Instead this PR makes a hotfix-only change and version bump for flutter_inappwebview_android. Since flutter_inappwebview specifies flutter_inappwebview_android: ^1.0.12 as dependency constraint, users should be able to get this fix on the next flutter pub get when this fix is published.
Testing and Review Notes
Building the flutter_inappwebview example app as an APK in release mode, on Flutter 3.22.1 should work.
Screenshots or Videos
N/A
To Do
- [x] double check the original issue to confirm it is fully satisfied
- [x] add testing notes and screenshots in PR description to help guide reviewers
- [x] request the "UX" team perform a design review (if/when applicable)
I got error trying this fork
flutter_inappwebview:
git:
url: https://github.com/navaronbracke/flutter_inappwebview.git
ref: master
path: flutter_inappwebview
$ flutter build apk ./lib/main/prod_main.dart --flavor prod --release --dart-define-from-file .env --no-tree-shake-icons
"en": 455 untranslated message(s).
To see a detailed report, use the untranslated-messages-file
option in the l10n.yaml file:
untranslated-messages-file: desiredFileName.txt
<other option>: <other selection>
This will generate a JSON format file containing all messages that
need to be translated.
/C:/Users/toshi/.puro/shared/pub_cache/git/flutter_inappwebview-4c58653113573558ea5be880aca931e85b23da7e/flutter_inappwebview/lib/src/webview_environment/webview_environment.dart:12:14: Error: Type 'PlatformWebViewEnvironmentCreationParams' not found.
required PlatformWebViewEnvironmentCreationParams params,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/C:/Users/toshi/.puro/shared/pub_cache/git/flutter_inappwebview-4c58653113573558ea5be880aca931e85b23da7e/flutter_inappwebview/lib/src/webview_environment/webview_environment.dart:19:9: Error: Type 'PlatformWebViewEnvironment' not found.
final PlatformWebViewEnvironment platform;
^^^^^^^^^^^^^^^^^^^^^^^^^^
/C:/Users/toshi/.puro/shared/pub_cache/git/flutter_inappwebview-4c58653113573558ea5be880aca931e85b23da7e/flutter_inappwebview/lib/src/webview_environment/webview_environment.dart:25:3: Error: Type 'WebViewEnvironmentSettings' not found.
WebViewEnvironmentSettings? get settings => platform.settings;
^^^^^^^^^^^^^^^^^^^^^^^^^^
/C:/Users/toshi/.puro/shared/pub_cache/git/flutter_inappwebview-4c58653113573558ea5be880aca931e85b23da7e/flutter_inappwebview/lib/src/webview_environment/webview_environment.dart:29:8: Error: Type 'WebViewEnvironmentSettings' not found.
{WebViewEnvironmentSettings? settings}) async {
^^^^^^^^^^^^^^^^^^^^^^^^^^
/C:/Users/toshi/.puro/shared/pub_cache/git/flutter_inappwebview-4c58653113573558ea5be880aca931e85b23da7e/flutter_inappwebview/lib/src/cookie_manager.dart:49:15: Error: No named parameter with the name 'webViewEnvironment'.
webViewEnvironment: webViewEnvironment.platform));
^^^^^^^^^^^^^^^^^^
/C:/Users/toshi/.puro/shared/pub_cache/hosted/pub.dev/flutter_inappwebview_platform_interface-1.0.10/lib/src/platform_cookie_manager.dart:19:9: Context: Found this candidate, but the arguments don't match.
const PlatformCookieManagerCreationParams();
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/C:/Users/toshi/.puro/shared/pub_cache/git/flutter_inappwebview-4c58653113573558ea5be880aca931e85b23da7e/flutter_inappwebview/lib/src/in_app_webview/in_app_webview.dart:315:15: Error: No named parameter with the name 'webViewEnvironment'.
webViewEnvironment: webViewEnvironment?.platform,
^^^^^^^^^^^^^^^^^^
/C:/Users/toshi/.puro/shared/pub_cache/hosted/pub.dev/flutter_inappwebview_platform_interface-1.0.10/lib/src/in_app_webview/platform_inappwebview_widget.dart:20:3: Context: Found this candidate, but the arguments don't match.
PlatformInAppWebViewWidgetCreationParams(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/C:/Users/toshi/.puro/shared/pub_cache/git/flutter_inappwebview-4c58653113573558ea5be880aca931e85b23da7e/flutter_inappwebview/lib/src/in_app_webview/in_app_webview_controller.dart:488:43: Error: The method 'openDevTools' isn't defined for the class 'PlatformInAppWebViewController'.
- 'PlatformInAppWebViewController' is from 'package:flutter_inappwebview_platform_interface/src/in_app_webview/platform_inappwebview_controller.dart' ('/C:/Users/toshi/.puro/shared/pub_cache/hosted/pub.dev/flutter_inappwebview_platform_interface-1.0.10/lib/src/in_app_webview/platform_inappwebview_controller.dart').
Try correcting the name to the name of an existing method, or defining a method named 'openDevTools'.
Future<void> openDevTools() => platform.openDevTools();
^^^^^^^^^^^^
/C:/Users/toshi/.puro/shared/pub_cache/git/flutter_inappwebview-4c58653113573558ea5be880aca931e85b23da7e/flutter_inappwebview/lib/src/in_app_webview/in_app_webview_controller.dart:493:16: Error: The method 'callDevToolsProtocolMethod' isn't defined for the class 'PlatformInAppWebViewController'.
- 'PlatformInAppWebViewController' is from 'package:flutter_inappwebview_platform_interface/src/in_app_webview/platform_inappwebview_controller.dart' ('/C:/Users/toshi/.puro/shared/pub_cache/hosted/pub.dev/flutter_inappwebview_platform_interface-1.0.10/lib/src/in_app_webview/platform_inappwebview_controller.dart').
Try correcting the name to the name of an existing method, or defining a method named 'callDevToolsProtocolMethod'.
platform.callDevToolsProtocolMethod(
^^^^^^^^^^^^^^^^^^^^^^^^^^
/C:/Users/toshi/.puro/shared/pub_cache/git/flutter_inappwebview-4c58653113573558ea5be880aca931e85b23da7e/flutter_inappwebview/lib/src/in_app_webview/in_app_webview_controller.dart:500:16: Error: The method 'addDevToolsProtocolEventListener' isn't defined for the class 'PlatformInAppWebViewController'.
- 'PlatformInAppWebViewController' is from 'package:flutter_inappwebview_platform_interface/src/in_app_webview/platform_inappwebview_controller.dart' ('/C:/Users/toshi/.puro/shared/pub_cache/hosted/pub.dev/flutter_inappwebview_platform_interface-1.0.10/lib/src/in_app_webview/platform_inappwebview_controller.dart').
Try correcting the name to the name of an existing method, or defining a method named 'addDevToolsProtocolEventListener'.
platform.addDevToolsProtocolEventListener(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/C:/Users/toshi/.puro/shared/pub_cache/git/flutter_inappwebview-4c58653113573558ea5be880aca931e85b23da7e/flutter_inappwebview/lib/src/in_app_webview/in_app_webview_controller.dart:506:16: Error: The method 'removeDevToolsProtocolEventListener' isn't defined for the class 'PlatformInAppWebViewController'.
- 'PlatformInAppWebViewController' is from 'package:flutter_inappwebview_platform_interface/src/in_app_webview/platform_inappwebview_controller.dart' ('/C:/Users/toshi/.puro/shared/pub_cache/hosted/pub.dev/flutter_inappwebview_platform_interface-1.0.10/lib/src/in_app_webview/platform_inappwebview_controller.dart').
Try correcting the name to the name of an existing method, or defining a method named 'removeDevToolsProtocolEventListener'.
platform.removeDevToolsProtocolEventListener(eventName: eventName);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/C:/Users/toshi/.puro/shared/pub_cache/git/flutter_inappwebview-4c58653113573558ea5be880aca931e85b23da7e/flutter_inappwebview/lib/src/in_app_webview/headless_in_app_webview.dart:312:11: Error: No named parameter with the name 'webViewEnvironment'.
webViewEnvironment: webViewEnvironment?.platform,
^^^^^^^^^^^^^^^^^^
/C:/Users/toshi/.puro/shared/pub_cache/hosted/pub.dev/flutter_inappwebview_platform_interface-1.0.10/lib/src/in_app_webview/platform_headless_in_app_webview.dart:18:9: Context: Found this candidate, but the arguments don't match.
const PlatformHeadlessInAppWebViewCreationParams(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/C:/Users/toshi/.puro/shared/pub_cache/git/flutter_inappwebview-4c58653113573558ea5be880aca931e85b23da7e/flutter_inappwebview/lib/src/in_app_browser/in_app_browser.dart:35:13: Error: No named parameter with the name 'webViewEnvironment'.
webViewEnvironment: webViewEnvironment?.platform,
^^^^^^^^^^^^^^^^^^
/C:/Users/toshi/.puro/shared/pub_cache/hosted/pub.dev/flutter_inappwebview_platform_interface-1.0.10/lib/src/in_app_browser/platform_in_app_browser.dart:34:9: Context: Found this candidate, but the arguments don't match.
const PlatformInAppBrowserCreationParams(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/C:/Users/toshi/.puro/shared/pub_cache/git/flutter_inappwebview-4c58653113573558ea5be880aca931e85b23da7e/flutter_inappwebview/lib/src/webview_environment/webview_environment.dart:12:14: Error: 'PlatformWebViewEnvironmentCreationParams' isn't a type.
required PlatformWebViewEnvironmentCreationParams params,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/C:/Users/toshi/.puro/shared/pub_cache/git/flutter_inappwebview-4c58653113573558ea5be880aca931e85b23da7e/flutter_inappwebview/lib/src/webview_environment/webview_environment.dart:13:36: Error: Method not found: 'PlatformWebViewEnvironment'.
}) : this.fromPlatform(platform: PlatformWebViewEnvironment(params));
^^^^^^^^^^^^^^^^^^^^^^^^^^
/C:/Users/toshi/.puro/shared/pub_cache/git/flutter_inappwebview-4c58653113573558ea5be880aca931e85b23da7e/flutter_inappwebview/lib/src/webview_environment/webview_environment.dart:19:9: Error: 'PlatformWebViewEnvironment' isn't a type.
final PlatformWebViewEnvironment platform;
^^^^^^^^^^^^^^^^^^^^^^^^^^
/C:/Users/toshi/.puro/shared/pub_cache/git/flutter_inappwebview-4c58653113573558ea5be880aca931e85b23da7e/flutter_inappwebview/lib/src/webview_environment/webview_environment.dart:29:8: Error: 'WebViewEnvironmentSettings' isn't a type.
{WebViewEnvironmentSettings? settings}) async {
^^^^^^^^^^^^^^^^^^^^^^^^^^
/C:/Users/toshi/.puro/shared/pub_cache/git/flutter_inappwebview-4c58653113573558ea5be880aca931e85b23da7e/flutter_inappwebview/lib/src/webview_environment/webview_environment.dart:31:25: Error: Undefined name 'PlatformWebViewEnvironment'.
platform: await PlatformWebViewEnvironment.static()
^^^^^^^^^^^^^^^^^^^^^^^^^^
/C:/Users/toshi/.puro/shared/pub_cache/git/flutter_inappwebview-4c58653113573558ea5be880aca931e85b23da7e/flutter_inappwebview/lib/src/webview_environment/webview_environment.dart:38:7: Error: Undefined name 'PlatformWebViewEnvironment'.
PlatformWebViewEnvironment.static().getAvailableVersion(
^^^^^^^^^^^^^^^^^^^^^^^^^^
/C:/Users/toshi/.puro/shared/pub_cache/git/flutter_inappwebview-4c58653113573558ea5be880aca931e85b23da7e/flutter_inappwebview/lib/src/webview_environment/webview_environment.dart:44:7: Error: Undefined name 'PlatformWebViewEnvironment'.
PlatformWebViewEnvironment.static()
^^^^^^^^^^^^^^^^^^^^^^^^^^
Target kernel_snapshot failed: Exception
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileFlutterBuildProdRelease'.
> Process 'command 'C:\Users\toshi\.puro\envs\v3_22_1\flutter\bin\flutter.bat'' finished with non-zero exit value 1
* 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 14s
Running Gradle task 'assembleProdRelease'... 15,2s
Gradle task assembleProdRelease failed with exit code 1
@toshiossada Your git override isn't entirely correct. You should be depending on the correct git ref branch.
I did not put my fix on master. Because the package is a federated plugin, I decided to locally test with dependency overrides for the android package (and the plugin interface, since that is a common one)
dependency_overrides:
flutter_inappwebview_android: # https://github.com/pichillilorenzo/flutter_inappwebview/issues/2139
git:
url: https://github.com/navaronbracke/flutter_inappwebview.git
path: flutter_inappwebview_android
ref: android_release_mode_hotfix
flutter_inappwebview_platform_interface: # https://github.com/pichillilorenzo/flutter_inappwebview/issues/2139
git:
url: https://github.com/navaronbracke/flutter_inappwebview.git
path: flutter_inappwebview_platform_interface
ref: android_release_mode_hotfix
I did locally also test against the plugin example app (but I used path overrides there, as in your PR)
When will this be fixed?
is the backevent issue fixed? still getting the error ERROR: R8: Missing class android.window.BackEvent (referenced from: void io.flutter.view.FlutterView.startBackGesture(android.window.BackEvent) and 1 other context)
what's the correct syntax for dependency overrides using this branch?
https://github.com/pichillilorenzo/flutter_inappwebview/pull/2231