簡體   English   中英

flutter iOS 構建失敗

[英]flutter iOS build failing

我正在嘗試使用 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! 使用WidgetsBinding.instance?.addPostFrameCallback

另外,嘗試做flutter cleanflutter pub get

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM