flutter iOS构建失败



我正试图使用iOS模拟器在VS CODE中运行我的flutter应用程序,但在我尝试运行它时遇到了这个错误。

code's output:
↳
Writing result bundle at path:
/var/folders/sq/dtjqcb_d6dl_fd5h0mrz2v3w0000gn/T/flutter_tools.VfxLC7/flutter_ios_build_temp_dirvSkZM4/temporary_xcresult_bundle
4
Invalid depfile: /Users/ga/Downloads/ca-main/.dart_tool/flutter_build/c223e2b93da92742124a153e03452ae1/kernel_snapshot.d
: Error: Not found: 'dart:js'
../…/lib/js.dart:8
export 'dart:js' show allowInterop, allowInteropCaptureThis;
^
: Warning: Operand of null-aware operation '!' has type 'WidgetsBinding' which excludes null.
: Warning: Operand of null-aware operation '!' has type 'WidgetsBinding' which excludes null.
lib/widgets/place_suggestion_widget.dart:18
- 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('../flutter/packages/flutter/lib/src/widgets/binding.dart').
package:flutter/…/widgets/binding.dart:1
WidgetsBinding.instance!.addPostFrameCallback((timeStamp) async{
^
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:652:37)
#2      writeDepfile (package:vm/kernel_front_end.dart:792:21)
<asynchronous suspension>
#3      FrontendCompiler.compile (file:///opt/s/w/ir/x/w/sdk/pkg/frontend_server/lib/frontend_server.dart:615:9)
<asynchronous suspension>
#4      starter (file:///opt/s/w/ir/x/w/sdk/pkg/frontend_server/lib/frontend_server.dart:1433:12)
<asynchronous suspension>
#5      main (file:///opt/s/w/ir/x/w/sdk/pkg/frontend_server/bin/frontend_server_starter.dart:10:14)
#5      main (file:///opt/s/w/ir/x/w/sdk/pkg/frontend_server/bin/frontend_server_starter.dart:10:14)
<asynchronous suspension>
Failed to package /Users/ga/Downloads/ca-main.
Command PhaseScriptExecution failed with a nonzero exit code
note: Using new build system
note: Planning
note: Build preparation complete
note: Building targets in dependency order
/Users/ga/Downloads/ca-main/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 15.5.99. (in target 'abseil' from project 'Pods')
/Users/ga/Downloads/ca-main/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 15.5.99. (in target 'BoringSSL-GRPC' from project 'Pods')
/var/folders/sq/dtjqcb_d6dl_fd5h0mrz2v3w0000gn/T/flutter_tools.VfxLC7/flutter_ios_build_temp_dirvSkZM4/temporary_xcresult_bundle
Could not build the application for the simulator.
Error launching application on iPod touch (7th generation).
Exited

构建一直失败,我不知道为什么。网上没有太多关于这个的信息。

我首先运行iOS模拟器,然后运行flutter运行。这样做running Xcode build,大约一分钟后抛出此错误。有什么想法吗?

在lib/widgets/place_suggestion_widget.dart:18中,尝试用WidgetsBinding.instance?.addPostFrameCallback替换WidgetsBinding.instance!

另外,尝试执行flutter cleanflutter pub get

相关内容

  • 没有找到相关文章

最新更新