PlatformException recreating_view
After upgrading to Flutter 3.27.0 I am getting this error on an iOS simulator (haven't tested on a device) after hot restarting. Also, the map view does not properly load.
Unhandled Exception: PlatformException(recreating_view, trying to create an already created view, view id: '0', null)
Hi @jnorkus, I can't reproduce the issue with Flutter 3.27, could you share a code snippet?
Hi! I’m also experiencing the same issue after upgrading to Flutter 3.27.0, specifically when performing a hot restart on the iOS simulator.
flutter: ══╡ EXCEPTION CAUGHT BY FLUTTER FRAMEWORK ╞═════════════════════════════════════════════════════════
flutter: The following PlatformException was thrown:
flutter: PlatformException(recreating_view, trying to create an already created view, view id: '0', null)
flutter:
flutter: When the exception was thrown, this was the stack:
flutter: #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:646:7)
flutter: #1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:334:18)
flutter: <asynchronous suspension>
flutter: #2 PlatformViewsService.initUiKitView (package:flutter/src/services/platform_views.dart:248:5)
flutter: <asynchronous suspension>
flutter: #3 _DarwinViewState._createNewUiKitView (package:flutter/src/widgets/platform_view.dart:921:36)
flutter: <asynchronous suspension>
flutter: ════════════════════════════════════════════════════════════════════════════════════════════════════
Hi @jnorkus, I can't reproduce the issue with Flutter 3.27, could you share a code snippet?
I was able to reproduce using the example project.
- Run on iOS simulator
- Go to "Display a simple map"
- Do a hot restart
- Go to "Display a simple map"
@jnorkus thank you for the clarification, still no luck on my side replicating this, could you share iOS and Xcode version you are using?
@jnorkus thank you for the clarification, still no luck on my side replicating this, could you share iOS and Xcode version you are using?
iOS 17.2 Xcode 15.2
I'll try upgrading my macOS to get the latest version of Xcode and see if that helps.
Same results on: iOS 18.2 Xcode 16.2
Reproducable on the example app in this repo as before. Please note that you have to do a hot restart (not hot reload).
I got the same issue, and just so you know downgrading to flutter v3.24.5 solved the issue. Do you need help to reproduce @evil159?
Same issue
Flutter (Channel stable, 3.27.1, on macOS 15.2 24C101 darwin-x64, locale en-GB)
• Flutter version 3.27.1 on channel stable at /Users/user/development/fluttersdk
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 17025dd882 (3 weeks ago), 2024-12-17 03:23:09 +0900
• Engine revision cb4b5fff73
• Dart version 3.6.0
• DevTools version 2.40.2
I've got the same issue on MapBox 2.4.0, Xcode 16.0
Flutter 3.27.1 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 17025dd882 (3 weeks ago) • 2024-12-17 03:23:09 +0900
Engine • revision cb4b5fff73
Tools • Dart 3.6.0 • DevTools 2.40.2
Same issue wit flutter 3.27.1
Seems to be a bug in Flutter itself https://github.com/flutter/flutter/issues/110381
Any news on this one, is it really a Flutter issue?
Any news ? Starting to happen with flutter 3.27.X
Today was merge a solution I think https://github.com/flutter/flutter/issues/163935, but is just for iOS
There were two separate fixes, one for iOS and one for macOS. Both have been merged to main. They should be available in the next major Flutter release.
macOS: https://github.com/flutter/flutter/issues/110381 iOS: https://github.com/flutter/flutter/issues/163935
I am facing this issue when debugging on iPhone 13 Pro with flutter 3.29.1
[ERROR:flutter/runtime/dart_vm_initializer.cc(40)] Unhandled Exception: PlatformException(recreating_view, trying to create an already created view, view id: '8', null)
#0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:652:7)
message_codecs.dart:652
#1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:370:18)
platform_channel.dart:370
using google map widget like this " SizedBox( width: 100, height: 100, child: GoogleMap( initialCameraPosition: CameraPosition( target: LatLng(address.latitude, address.longitude), zoom: 14, ), zoomControlsEnabled: false, scrollGesturesEnabled: false, tiltGesturesEnabled: false, rotateGesturesEnabled: false, myLocationButtonEnabled: false, ), ),"
upgrading to flutter 3.29.2 and will test
Still same issue on flutter 3.29.2, I added unique keys but still.
The fixes are in release 3.30.0-0.1.pre (the 3.30 beta release). They'll also be in the next major stable release, which will be presumably 3.31 or 3.32.
Still same issue on Flutter 3.29.2 • channel stable, waiting for stable release 3.31+
Same issue on Flutter 3.29.1. This error seems to be very specific to embedded views like maps or iframes. I get the error in a Mac app using the flutter_inappwebview package, and I get the same error using maps on iOS. It may be specific to iOS and macOS.
I also find that when I reload several times, the number of IDs increases until I find one that works correctly after several refreshes.
PlatformException(recreating_view, trying to create an already created view, view id: '1 or 2 or 3 or 4 ... n', null)
I'm waiting for the new version. It seems they've already fixed it, but it hasn't been merged into the main version yet. Hopefully it'll be fixed soon.
update?
Is there any update regarding this topic?
The underlying bug in Flutter was fixed in Flutter 3.30 (beta). It's not being backported to the 3.29 series. You have the option of using the latest Flutter beta, which is Flutter 3.32. Or waiting for whatever the next major stable release will be, which might be Flutter 3.33.
I'm facing the same issue. It seems to be a Flutter related problem rather than a Mapbox.