Dart-Code / Dart-Code

Dart and Flutter support for VS Code
https://dartcode.org/
MIT License
1.46k stars 295 forks source link

Building Flutter iOS app using VS Code breaks the build #5103

Closed lukehutch closed 2 weeks ago

lukehutch commented 3 weeks ago

If I build my iOS Flutter app with VS Code, the build breaks with this error message:

Launching lib/main.dart on iPhone SE (2nd generation) in debug mode...
Automatically signing iOS for device deployment using specified development team in Xcode project: 9BK2J3MZKX
Xcode build done.                                           34.6s
Failed to build iOS app
Could not build the precompiled application for the device.
Uncategorized (Xcode): Could not resolve package dependencies:
  downloaded archive of binary target 'absl' from 'https://dl.google.com/firebase/ios/bin/abseil/1.2024011601.1/rc0/absl.zip' does not contain a binary artifact.
  downloaded archive of binary target 'openssl_grpc' from 'https://dl.google.com/firebase/ios/bin/grpc/1.62.2/rc0/openssl_grpc.zip' does not contain a binary artifact.
  downloaded archive of binary target 'grpcpp' from 'https://dl.google.com/firebase/ios/bin/grpc/1.62.2/rc0/grpcpp.zip' does not contain a binary artifact.
  downloaded archive of binary target 'grpc' from 'https://dl.google.com/firebase/ios/bin/grpc/1.62.2/rc0/grpc.zip' does not contain a binary artifact.
  fatalError
3

Error launching application on iPhone SE (2nd generation).

Subsequently, running flutter build ipa from the commandline and also building from Xcode both fail with the same error.

The only way to fix it is to quit Xcode and run rm -rf ~/Library/Caches/com.apple.dt.Xcode (which I understand is heavy-handed, but I have no idea what in this cache is broken).

After that fix, flutter build ipa and building/running in Xcode work again. So it is only the VS Code build that is broken. (I have no idea if Dart-Code is responsible for VS Code builds -- sorry if this is mis-filed the issue...)

Workspace Environment ```text Dart Code extension: 3.89.20240509 Flutter extension: 3.89.20240501 (activated) App: Visual Studio Code App Host: desktop Version: mac 1.89.0 Workspace type: Flutter (LSP) Dart (3.4.0-282.3.beta): /Users/luke/flutter/bin/cache/dart-sdk Flutter (3.22.0-0.3.pre): /Users/luke/flutter (iPhone SE (2nd generation) (ios/ios)) ```
Output from 'dart info' `/Users/luke/flutter/bin/cache/dart-sdk/bin/dart info` If providing this information as part of reporting a bug, please review the information below to ensure it only contains things you're comfortable posting publicly. #### General info - Dart 3.4.0-282.3.beta (beta) (Tue Apr 23 15:11:21 2024 +0000) on "macos_x64" - on macos / Version 14.4.1 (Build 23E224) - locale is en-US #### Project info - sdk constraint: '>=3.1.5' - dependencies: auto_size_text, boxy, bubble, cached_network_image, carousel_slider, chat_message_timestamp, collection, cross_file, cupertino_http, cupertino_icons, dart_emoji, delayed_display, device_info_plus, dio, dio_smart_retry, email_validator, exif, extended_image, file_picker, flutter, flutter_cache_manager, flutter_email_sender, flutter_google_maps_webservices, flutter_image_utilities, flutter_localizations, flutter_persistent_value_notifier, flutter_staggered_grid_view, flutter_svg, flutter_value_notifier_stateful_widget, fluttericon, fluttertoast, geocoding, geolocator, google_fonts, google_maps_flutter, google_maps_webapi, google_places_flutter, http, image_crop, image_picker, image_picker_android, image_picker_platform_interface, intl, jiffy, keep_keyboard_popup_menu, latlong2, line_awesome_flutter, logging, maps_launcher, material_dialogs, package_info_plus, path_provider, persistent_bottom_nav_bar_v2, pexels_api, pinch_to_zoom_scrollable, provider, serverpod_auth_apple_flutter, serverpod_auth_client, serverpod_auth_facebook_flutter, serverpod_auth_google_flutter, serverpod_auth_shared_flutter, serverpod_client, serverpod_flutter, serverpod_serialization, share_plus, shared_preferences, syncfusion_flutter_datepicker, timezone, url_launcher - dev_dependencies: flutter_launcher_icons, flutter_lints, flutter_native_splash, flutter_test, lints - elided dependencies: 1 #### Process info | Memory | CPU | Elapsed time | Command line | | -----: | ---: | -----------: | -------------------------------------------------------------------------------------- | | 13 MB | 0.0% | 01:00:13 | dart devtools --machine --allow-embedding --dtd-uri ws:/0iD7aFnaZUnUUfQR | | 182 MB | 0.6% | 01:00:13 | dart language-server --protocol=lsp --client-id=VS-Code --client-version=3.89.20240509 | | 15 MB | 0.0% | 01:00:13 | dart tooling-daemon --machine | | 49 MB | 0.2% | 01:00:13 | flutter_tools.snapshot daemon |
Output from 'flutter doctor' `/Users/luke/flutter/bin/flutter doctor -v` ```text [✓] Flutter (Channel beta, 3.22.0-0.3.pre, on macOS 14.4.1 23E224 darwin-x64, locale en-US) • Flutter version 3.22.0-0.3.pre on channel beta at /Users/luke/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 87b652410d (2 weeks ago), 2024-04-23 21:41:18 -0500 • Engine revision b4bfd45986 • Dart version 3.4.0 (build 3.4.0-282.3.beta) • DevTools version 2.34.3 [!] Android toolchain - develop for Android devices (Android SDK version 34.0.0) • Android SDK at /Users/luke/Library/Android/sdk • Platform android-34, build-tools 34.0.0 • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11572160) ! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses [✓] Xcode - develop for iOS and macOS (Xcode 15.3) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 15E204a • CocoaPods version 1.15.2 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 2023.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 17.0.10+0-17.0.10b1087.21-11572160) [✓] VS Code (version 1.89.0) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.89.20240501 [✓] Connected device (4 available) • iPhone SE (2nd generation) (mobile) • 00008030-000C38343C23402E • ios • iOS 17.4.1 21E236 • iPhone 15 Pro (mobile) • 9AB15F56-DA2E-49B9-A01B-CCD98D5FDCAB • ios • com.apple.CoreSimulator.SimRuntime.iOS-17-4 (simulator) • macOS (desktop) • macos • darwin-x64 • macOS 14.4.1 23E224 darwin-x64 • Chrome (web) • chrome • web-javascript • Google Chrome 124.0.6367.156 [✓] Network resources • All expected network resources are available. ! Doctor found issues in 1 category. ```
DanTup commented 2 weeks ago

VS Code is really just calling flutter run so I don't think it's directly to blame - but it could be doing something to trigger this.

My first question would be whether running from the terminal with flutter run can also trigger this error (and subsequent breakage). I assume it can (because that's all VS Code is really doing), but it's worth verifying.

If it does, then it would be better to file this in flutter/flutter (where there is more knowledge about Xcode than the little I have). If it doesn't, then we should try to understand what's different between VS Code and the terminal (usually this is things like env variables set in terminal startup scripts, and one way to debug further is to launch VS Code from the terminal where it works so it inherits all of the env vars, and then test in VS Code again).

lukehutch commented 2 weeks ago

Thanks for the explanation. After days of battling this and other issues, I can no longer replicate this anyway, so I will go ahead and close it.