项目运行之前没有任何错误。然后我将Xcode从13更新到14,突然应用程序停止工作并抛出以下错误:
[ +16 ms] /Users/arunmaharjan/Development/sdks/flutter/bin/cache/dart-sdk/bin/dart --disable-dart-dev /Users/arunmaharjan/Development/sdks/flutter/bin/cache/artifacts/engine/darwin-x64/frontend_server.dart.snapshot --sdk-root /Users/arunmaharjan/Development/sdks/flutter/bin/cache/artifacts/engine/common/flutter_patched_sdk/ --target=flutter --no-print-incremental-dependencies -DAPP_ENV=production -DFLUTTER_WEB_AUTO_DETECT=true -Ddart.vm.profile=false -Ddart.vm.product=false --enable-asserts --track-widget-creation --no-link-platform --packages /Users/arunmaharjan/Blacksheep/projects/flutter/swg_pro/.dart_tool/package_config.json --output-dill /Users/arunmaharjan/Blacksheep/projects/flutter/swg_pro/.dart_tool/flutter_build/b510feac84446de731c63e92801e95fa/app.dill --depfile /Users/arunmaharjan/Blacksheep/projects/flutter/swg_pro/.dart_tool/flutter_build/b510feac84446de731c63e92801e95fa/kernel_snapshot.d /Users/arunmaharjan/Blacksheep/projects/flutter/swg_profff/.dart_tool/flutter_build/generated_main.dart
[ +81 ms] Persisting file store
[ +7 ms] Done persisting file store
[ +16 ms] "flutter assemble" took 14,451ms.
[ +7 ms] ensureAnalyticsSent: 3ms
[ +1 ms] Running shutdown hooks
[ ] Shutdown hooks complete
[ +3 ms] exiting with code 1
[+1394 ms] ../../../../.pub-cache/hosted/pub.dartlang.org/js-0.6.3/lib/js.dart:8:1: Error: Not found: 'dart:js'
js.dart:8
[ +8 ms] export 'dart:js' show allowInterop, allowInteropCaptureThis;
[ ] ^
[ +249 ms] ../../../../.pub-cache/hosted/pub.dartlang.org/js-0.6.3/lib/js_util.dart:8:1: Error: Not found: 'dart:js_util'
js_util.dart:8
[ ] export 'dart:js_util';
[ ] ^
[+2226 ms] ../../../../.pub-cache/hosted/pub.dartlang.org/firebase_core-1.24.0/lib/src/firebase_app.dart:18:25: Error: Member not found: 'FirebaseAppPlatform.verifyExtends'.
firebase_app.dart:18
[ ] FirebaseAppPlatform.verifyExtends(_delegate);
[ ] ^^^^^^^^^^^^^
[+3205 ms] ../../../../.pub-cache/hosted/pub.dartlang.org/firebase_core_web-1.7.3/lib/src/interop/utils/js_interop.dart:25:12: Error: Method not found: 'hasProperty'.
js_interop.dart:25
[ ] if (util.hasProperty(jsObject, 'toDateString')) {
[ ] ^^^^^^^^^^^
[ +1 ms] ../../../../.pub-cache/hosted/pub.dartlang.org/firebase_core_web-1.7.3/lib/src/interop/utils/utils.dart:45:31: Error: Method not found: 'getProperty'.
utils.dart:45
[ ] map[key] = dartify(util.getProperty(jsObject, key), customDartify);
[ ] ^^^^^^^^^^^
[ ] ../../../../.pub-cache/hosted/pub.dartlang.org/firebase_core_web-1.7.3/lib/src/interop/utils/utils.dart:81:22: Error: Method not found: 'newObject'.
utils.dart:81
[ ] var jsMap = util.newObject();
[ ] ^^^^^^^^^
[ ] ../../../../.pub-cache/hosted/pub.dartlang.org/firebase_core_web-1.7.3/lib/src/interop/utils/utils.dart:83:12: Error: Method not found: 'setProperty'.
utils.dart:83
[ ] util.setProperty(jsMap, key, jsify(value, customJsify));
[ ] ^^^^^^^^^^^
[ ] ../../../../.pub-cache/hosted/pub.dartlang.org/firebase_core_web-1.7.3/lib/src/interop/utils/utils.dart:89:12: Error: Method not found: 'allowInterop'.
utils.dart:89
[ ] return allowInterop(dartObject);
[ ] ^^^^^^^^^^^^
[ ] ../../../../.pub-cache/hosted/pub.dartlang.org/firebase_core_web-1.7.3/lib/src/interop/utils/utils.dart:103:10: Error: Method not found: 'callMethod'.
utils.dart:103
[ ] util.callMethod(jsObject, method, args);
[ ] ^^^^^^^^^^
[ ] ../../../../.pub-cache/hosted/pub.dartlang.org/firebase_core_web-1.7.3/lib/src/interop/utils/utils.dart:116:15: Error: Method not found: 'promiseToFuture'.
utils.dart:116
[ ] return util.promiseToFuture(thenable);
[ ] ^^^^^^^^^^^^^^^
[ ] ../../../../.pub-cache/hosted/pub.dartlang.org/firebase_core_web-1.7.3/lib/src/interop/utils/utils.dart:124:27: Error: Method not found: 'allowInterop'.
utils.dart:124
[ ] return PromiseJsImpl<S>(allowInterop((
[ ] ^^^^^^^^^^^^
[+5040 ms] Unhandled exception:
FileSystemException(uri=org-dartlang-untranslatable-uri:dart%3Ajs; message=StandardFileSystem only supports file:* and data:* URIs)
#0 StandardFileSystem.entityForUri (package:front_end/src/api_prototype/standard_file_system.dart:34:7)
#1 asFileUri (package:vm/kernel_front_end.dart:623:37)
#2 writeDepfile (package:vm/kernel_front_end.dart:763:21)
<asynchronous suspension>
#3 FrontendCompiler.compile (package:frontend_server/frontend_server.dart:586:9)
<asynchronous suspension>
#4 starter (package:flutter_frontend_server/server.dart:85:12)
<asynchronous suspension>
#5 main (file:///opt/s/w/ir/cache/builder/src/flutter/flutter_frontend_server/bin/starter.dart:13:24)
<asynchronous suspension>
[ +6 ms] Target kernel_snapshot failed: Exception
#0 KernelSnapshot.build (package:flutter_tools/src/build_system/targets/common.dart:241:7)
<asynchronous suspension>
#1 _BuildInstance._invokeInternal (package:flutter_tools/src/build_system/build_system.dart:839:9)
<asynchronous suspension>
#2 Future.wait.<anonymous closure> (dart:async/future.dart:473:21)
<asynchronous suspension>
#3 _BuildInstance.invokeTarget (package:flutter_tools/src/build_system/build_system.dart:777:32)
<asynchronous suspension>
#4 FlutterBuildSystem.build (package:flutter_tools/src/build_system/build_system.dart:606:16)
<asynchronous suspension>
#5 AssembleCommand.runCommand (package:flutter_tools/src/commands/assemble.dart:317:32)
<asynchronous suspension>
#6 FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1161:27)
<asynchronous suspension>
#7 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#8 CommandRunner.runCommand
command_runner.dart:209
<asynchronous suspension>
#9 FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:281:9)
#10 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#11 FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:229:5)
<asynchronous suspension>
#12 run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:62:9)
<asynchronous suspension>
#13 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#14 main (package:flutter_tools/executable.dart:94:3)
<asynchronous suspension>
[ +5 ms]
#0 throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
#1 AssembleCommand.runCommand (package:flutter_tools/src/commands/assemble.dart:334:7)
<asynchronous suspension>
#2 FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1161:27)
<asynchronous suspension>
#3 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#4 CommandRunner.runCommand
command_runner.dart:209
<asynchronous suspension>
#5 FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:281:9)
<asynchronous suspension>
#6 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#7 FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:229:5)
<asynchronous suspension>
#8 run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:62:9)
<asynchronous suspension>
#9 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#10 main (package:flutter_tools/executable.dart:94:3)
<asynchronous suspension>
Failed to package /Users/arunmaharjan/Blacksheep/projects/flutter/swg_pro.
Command PhaseScriptExecution failed with a nonzero exit code
warning: Run script build phase 'Run Script' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'Runner' from project 'Runner')
warning: Run script build phase 'Thin Binary' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'Runner' from project 'Runner')
Result bundle written to path:
/var/folders/x_/hj62v_0j67d7wq80vgl5btr00000gn/T/flutter_tools.ABVYp9/flutter_ios_build_temp_dir5dmQTT/temporary_xcresult_bundle
[+1037 ms] Could not build the application for the simulator.
[ +9 ms] Error launching application on iPhone 14 Pro Max.
Exited (sigterm)
~ flutter doctor -v
[✓] Flutter (Channel unknown, 2.10.3, on macOS 13.2 22D49 darwin-arm, locale en-NP)
• Flutter version 2.10.3 at /Users/arunmaharjan/Development/sdks/flutter
• Upstream repository unknown
• Framework revision 7e9793dee1 (1 year, 1 month ago), 2022-03-02 11:23:12 -0600
• Engine revision bd539267b4
• Dart version 2.16.1
• DevTools version 2.9.2
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
• Android SDK at /Users/arunmaharjan/Library/Android/sdk
• Platform android-33, build-tools 33.0.0
• Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
• Xcode at /Applications/Xcode.app/Contents/Developer
• CocoaPods version 1.11.3
[✓] Android Studio (version 2021.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.13+0-b1751.21-8125866)
[✓] VS Code (version 1.77.0)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.60.0
[✓] Connected device (1 available)
• iPhone 14 Pro Max (mobile) • 0FB13EFF-CD33-4538-A9DD-C09F3B056B68 • ios • com.apple.CoreSimulator.SimRuntime.iOS-16-2 (simulator)
[✓] HTTP Host Availability
• All required HTTP hosts are available
• No issues found!
我尝试过的解决方案
1。
~ flutter clean
~ cd ios && rm -rf Pods Podfile.lock
~ pod install
# Then run the flutter project
- 将扑动版本从2.10.3更改为2.10.5。它不工作,并再次恢复。
下面是我的pubspec.yml
name: swg_pro
description: The SWG app for the professionals.
# The following line prevents the package from being accidentally published to
# pub.dev using `flutter pub publish`. This is preferred for private packages.
publish_to: "none" # Remove this line if you wish to publish to pub.dev
# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+3
environment:
sdk: ">=2.16.1 <3.0.0"
# Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions
# consider running `flutter pub upgrade --major-versions`. Alternatively,
# dependencies can be manually updated by changing the version numbers below to
# the latest version available on pub.dev. To see which dependencies have newer
# versions available, run `flutter pub outdated`.
dependencies:
flutter:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.2
flutter_native_splash: ^2.1.6
flutter_svg: ^1.0.3
animations: ^2.0.2
shared_preferences: ^2.0.13
shared_preferences_android: ^2.0.8
shared_preferences_ios: ^2.0.8
dio: ^4.0.4
flutter_dotenv: ^5.0.2
connectivity_plus: ^2.3.0
provider: ^6.0.2
fluttertoast: ^8.0.9
pin_code_fields: ^7.3.0
dotted_border: ^2.0.0+2
image_picker: ^0.8.5
file_picker: ^4.4.0
flutter_cache_manager: ^3.3.0
open_file: ^3.0.3
flutter_switch: ^0.3.2
intl: ^0.17.0
table_calendar: ^3.0.7
flutter_widget_from_html: ^0.8.5
html_editor_enhanced: ^2.4.0+1
plural_noun: ^0.1.2
agora_rtm: ^1.1.0
agora_rtc_engine: ^5.1.0
permission_handler: ^9.2.0
firebase_core: ^1.23.0
firebase_messaging: ^13.0.3
random_string: ^2.3.1
slugify: ^2.0.0
ffcache: ^1.1.0
callkeep: ^0.3.2
connectycube_flutter_call_kit:
path: ./connectycube-flutter-call-kit
navigation_history_observer: ^1.1.0
flutter_local_notifications: ^9.2.0
background_fetch: ^1.0.3
audioplayers: ^1.1.1
uuid: ^3.0.6
device_info_plus: ^4.0.0
sentry_flutter: ^6.12.2
# flutter_apns_only: ^1.6.0
flutter_ios_voip_kit: #^0.1.0
path: ./flutter_ios_voip_kit
# git:
# url: https://github.com/ad1199/flutter_ios_voip_kit
# ref: develop
pusher_channels_flutter: ^2.1.0
badges: ^2.0.3
flutter_share: ^2.0.0
flutter_foreground_task: ^3.10.0
dev_dependencies:
flutter_test:
sdk: flutter
flutter_launcher_icons: "^0.10.0"
# The "flutter_lints" package below contains a set of recommended lints to
# encourage good coding practices. The lint set provided by the package is
# activated in the `analysis_options.yaml` file located at the root of your
# package. See that file for information about deactivating specific lint
# rules and activating additional ones.
flutter_lints: ^1.0.0
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
# The following section is specific to Flutter.
flutter:
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true
# To add assets to your application, add an assets section, like this:
assets:
- .env.demo
- .env.development
- .env.production
- assets/images/
- assets/images/doctor/
- assets/audio/callertune.mp3
- assets/audio/call_waiting.mp3
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware.
# For details regarding adding assets from package dependencies, see
# https://flutter.dev/assets-and-images/#from-packages
# To add custom fonts to your application, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
fonts:
- family: Poppins
fonts:
- asset: assets/fonts/poppins-bold.ttf
weight: 700
style: normal
- asset: assets/fonts/poppins-semi_bold.ttf
weight: 600
style: normal
- asset: assets/fonts/poppins-regular.ttf
weight: 500
style: normal
# For details regarding fonts from package dependencies,
# see https://flutter.dev/custom-fonts/#from-packages
有谁能帮我弄清楚吗?谢谢你!这是一个很常见的问题,
-
尝试导入js: ^ 0.6.2
则
flutter clean
和flutter pub get
现在将这行粘贴到你的类中"import import 'dart:js';">
如果这还不能解决你的问题
-
进入您的flutter安装目录=>/.pub-cache/托管/pub.dartlang.org/js-0.6.3-nullsafety.1/lib/js.dart
,删除
export 'dart:js' show allowInterop, allowInteropCaptureThis;