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

[MacOS] PlatformException(recreating_view, trying to create an already created view, view id: '0', null) #1

Open
zhahouming opened this issue Nov 27, 2023 · 3 comments

Comments

@zhahouming
Copy link

在MacOS中,刚开始可以正常打开页面,reload或者restart几次以后,无法正常打开并提示以下错误:

PlatformException(recreating_view, trying to create an already created view, view id: '0', null)
#0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:652:7)
#1      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:310:18)
<asynchronous suspension>
#2      PlatformViewsService.initUiKitView (package:flutter/src/services/platform_views.dart:242:5)
<asynchronous suspension>
#3      _UiKitViewState._createNewUiKitView (package:flutter/src/widgets/platform_view.dart:662:44)
<asynchronous suspension>

关键代码:

BaseFlWebView(
  load: LoadUrlRequest("https://www.iqiyi.com/"),
  onWebViewCreated: (controller) {
    _controller = controller;
  },
)

无其他特殊代码

本机开发环境:

fl doctor -v
[✓] Flutter (Channel stable, 3.13.6, on macOS 13.1 22C65 darwin-x64, locale zh-Hans-CN)
    • Flutter version 3.13.6 on channel stable at /Users/myuser/fvm/versions/3.7.10
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision ead455963c (9 weeks ago), 2023-09-26 18:28:17 -0700
    • Engine revision a794cf2681
    • Dart version 3.1.3
    • DevTools version 2.25.0

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /Users/myuser/Library/Android/sdk
    • Platform android-33, build-tools 30.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.3.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14E300c
    • CocoaPods version 1.11.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.1)
    • 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.15+0-b2043.56-8887301)

[✓] VS Code (version 1.84.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.76.0

[!] Proxy Configuration
    • HTTP_PROXY is set
    ! NO_PROXY is not set

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-x64     • macOS 13.1 22C65 darwin-x64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 115.0.5790.170

[✓] Network resources
    • All expected network resources are available.

! Doctor found issues in 1 category.
@zhahouming
Copy link
Author

akaboshinit/flutter_inline_webview_macos#12 类似问题

@zhahouming
Copy link
Author

Implement PlatformView support on macOS 相关讨论

@renanyoy
Copy link

renanyoy commented Dec 4, 2023

I have same problem, but for me it happens only on hot restart. I think because view ID counter is reset on the flutter side, and the older platform views are still alive..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants