-
Notifications
You must be signed in to change notification settings - Fork 28.9k
Closed
flutter/plugins
#4618Labels
P1High-priority issues at the top of the work listHigh-priority issues at the top of the work listc: regressionIt was better in the past than it is nowIt was better in the past than it is nowp: webviewThe WebView pluginThe WebView pluginpackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.platform-androidAndroid applications specificallyAndroid applications specificallyr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer version
Description
Steps to Reproduce
I'm tired of writing minimal reproducible repository, sorry for that. If my explanation is insufficient, please comment.
- Build and run the following in android.
Column(children:[
WebView(
initialUrl: 'somewhere.net',
userAgent: 'some user agent',
),
ElevatedButton(onPressed: () => setState(() {}), child: Text('rebuild')),
])
- Press the button.
- Browse to other page in webview or create xhr.
- Check user agent of the second request.
Expected results: it should send the user agent string 'some user agent'
.
Actual results: User agent string is set at first, but it reverted to the default in the second request in the webview page.
Additional context
The following is brief tracking by debugger.
webview_flutter_android 2.3.0 introduced this change. From this absent()
value is passed for presenting no change of user agent string, but webView.settings.setUserAgentString('');
clear previously set user agent.
It broke my app behavior so I think this is a regression.
Logs
> flutter analyze
The plugin `flutter_webview_plugin` uses a deprecated version of the Android embedding.
To avoid unexpected runtime failures, or future build failures, try to see if this plugin supports the Android V2 embedding. Otherwise, consider removing it since a future release of Flutter will remove these deprecated APIs.
If you are plugin author, take a look at the docs for migrating the plugin to the V2 embedding: https://flutter.dev/go/android-plugin-migration.
Analyzing app...
info • Unused import: 'package:collection/collection.dart' • lib/pages/challenge/challenge_page.dart:1:8 • unused_import
info • Unused import: 'package:collection/collection.dart' • lib/services/util.dart:1:8 • unused_import
2 issues found. (ran in 10.4s)
> flutter doctor -v
[✓] Flutter (Channel stable, 2.5.3, on macOS 12.0.1 21A559 darwin-x64, locale en-KR)
• Flutter version 2.5.3 at /Users/jeiea/.asdf/installs/flutter/2.0.0-stable
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 18116933e7 (8 weeks ago), 2021-10-15 10:46:35 -0700
• Engine revision d3ea636dc5
• Dart version 2.14.4
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at /Users/jeiea/Library/Android/sdk
• Platform android-31, build-tools 31.0.0
• Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 13.1, Build version 13A1030d
• CocoaPods version 1.11.2
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[!] Android Studio
• Android Studio at /Applications/Android Studio Preview.app/Contents
• 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
✗ Unable to find bundled Java version.
• Try updating or re-installing Android Studio.
[✓] Android Studio (version 2020.3)
• Android Studio at /Applications/Android Studio.app/Contents
• 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 11.0.10+0-b96-7281165)
[✓] VS Code (version 1.62.3)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.29.0
[✓] Connected device (3 available)
• SM G996N (mobile) • R3CR10909RV • android-arm64 • Android 11 (API 30)
• iPhone (mobile) • 3cab6ea47af788fbe8d5001e572f5d4c6bb69138 • ios • iOS 15.1 19B74
• Chrome (web) • chrome • web-javascript • Google Chrome 96.0.4664.93
! Doctor found issues in 1 category.
Metadata
Metadata
Assignees
Labels
P1High-priority issues at the top of the work listHigh-priority issues at the top of the work listc: regressionIt was better in the past than it is nowIt was better in the past than it is nowp: webviewThe WebView pluginThe WebView pluginpackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.platform-androidAndroid applications specificallyAndroid applications specificallyr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer version