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.3k stars 1.64k forks source link

Android specific options (useWideViewPort, loadWithOverviewMode, supportZoom, builtInZoomContros, displayZoomControls) not working on apk release #280

Closed furiousdazzewizard closed 1 month ago

furiousdazzewizard commented 4 years ago

Environment

Flutter version: v1.12.13+hotfix.7, on Microsoft Windows [Version 10.0.17763.973] Plugin version: Flutter plugin version 43.0.1 on Android Studio 3.5 Android version: Android 9 (API 28) iOS version: N/A Xcode version: N/A Device information: SM J400M • 42006eb568b2a543 • android-arm • Android 9 (API 28)

Description

The above mentioned android specific options work fine on the debug version of the app. On the release version, however, neither of those options work (seems to be unavailable).

Expected behavior: For example, the web page should be displayed in overview mode, with a desktop-like view. image

Current behavior: the web page is displayed in its original size, bigger than the screen size of the webview.. In addition, zoom support is not available so it is not possible to fit size.

image

Steps to reproduce

  1. Make a project with a web view to shop an given url with the above mentioned android options activated: . . . @override Widget build(BuildContext context) { data = ModalRoute.of(context).settings.arguments; return Scaffold( appBar: AppBar( title: Text( 'any text...', style: GoogleFonts.indieFlower(), ), elevation: 15.0, ), body: InAppWebView( initialUrl: data['url'], initialHeaders: {}, initialOptions: InAppWebViewWidgetOptions( crossPlatform: InAppWebViewOptions( preferredContentMode: InAppWebViewUserPreferredContentMode.DESKTOP, ), android: AndroidInAppWebViewOptions( useWideViewPort: true, loadWithOverviewMode: true, supportZoom: true, builtInZoomControls: true, displayZoomControls: true, ), ), onWebViewCreated: (InAppWebViewController controller) { webView = controller; }, ), ); }
  2. Generate the debug apk and/or run the app from IDE and you will get the EXPECTED behaviour
  3. Generate the release apk, install & run it in the smartphone and you will get the CURRENT behaviour
chrisnyw commented 4 years ago

after a couple of time to cater with this issue, I just get a workaround to solve this,

when building a release build of apk, pass also the --no-shrink to flutter build flutter build apk --no-shrink

I got the following debug lot when enabled the debug log option in WebView, and it is only happened in release build but not debug build.

02-24 16:34:50.051 13671 13671 D Options : No field useShouldOverrideUrlLoading in class Lcom/pichillilorenzo/flutter_inappwebview/InAppWebView/G; (declaration of 'com.pichillilorenzo.flutter_inappwebview.InAppWebView.G' appears in base.apk) 02-24 16:34:50.051 13671 13671 D Options : No field initialScale in class Lcom/pichillilorenzo/flutter_inappwebview/InAppWebView/G; (declaration of 'com.pichillilorenzo.flutter_inappwebview.InAppWebView.G' appears in base.apk)

hope it may help you

aboutmydreams commented 4 years ago

I just use AndroidInAppWebViewOptions : databaseEnabled: true, domStorageEnabled: true,

Successfully run in debug mode,but fail in flutter build apk --target-platform android-arm,android-arm64 --split-per-abi

github-actions[bot] commented 1 month ago

This issue is stale and has been automatically closed because it has been open for more than 365 days with no activity. Please reopen a new issue if you still have it.

github-actions[bot] commented 1 month ago

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.