Flutter VSCode 调试 - 不允许资源分叉、查找器信息或类似碎片

问题描述 投票:0回答:1

我是一个颤振新手,正在尝试按照 this 教程构建我的第一个应用程序。本教程提供了开始测试的所有代码,但在调试时我无法通过构建阶段(this 视频的 15:15 分钟)。我不断收到以下错误。

Launching lib/main.dart on macOS in debug mode...
/Users/adgb/Documents/dev/flutter_application_1/build/macos/Build/Products/Debug/flutter_application_1.app: resource fork, Finder information, or similar detritus not allowed
Command CodeSign failed with a nonzero exit code
** BUILD FAILED **

Error: Build process failed

Exited (1).

我找到了官方的Apple解决方案here,在thisthisthis帖子中也提到了。

我了解问题所在,并尝试在主应用程序目录 (/Users/adgb/Documents/dev/flutter_application_1) 和错误中引用的目录 (/Users/adgb/Documents/dev/flutter_application_1) 中运行

xattr -cr .
/build/macos/Build/Products/Debug/flutter_application_1.app),但是当我尝试构建应用程序时,它仍然失败。

在任一目录中运行

xattr -cr .
命令不会输出任何结果。

(base) adgb@adgbs-MacBook-Pro flutter_application_1.app % pwd
/Users/adgb/Documents/dev/flutter_application_1/build/macos/Build/Products/Debug/flutter_application_1.app
(base) adgb@adgbs-MacBook-Pro flutter_application_1.app % xattr -cr .
(base) adgb@adgbs-MacBook-Pro flutter_application_1.app %
(base) adgb@adgbs-MacBook-Pro flutter_application_1 % pwd
/Users/adgb/Documents/dev/flutter_application_1
(base) adgb@adgbs-MacBook-Pro flutter_application_1 % xattr -cr .
(base) adgb@adgbs-MacBook-Pro flutter_application_1 %

当我在错误中引用的目录中运行

xattr -lr
命令时,我得到以下输出:

(base) adgb@adgbs-MacBook-Pro flutter_application_1.app % xattr -lr /Users/adgb/Documents/dev/flutter_application_1/build/macos/Build/Products/Debug/flutter_application_1.app
/Users/adgb/Documents/dev/flutter_application_1/build/macos/Build/Products/Debug/flutter_application_1.app/Contents/Frameworks/FlutterMacOS.framework: com.apple.FinderInfo:
/Users/adgb/Documents/dev/flutter_application_1/build/macos/Build/Products/Debug/flutter_application_1.app/Contents/Frameworks/FlutterMacOS.framework: com.apple.fileprovider.fpfs#P:
/Users/adgb/Documents/dev/flutter_application_1/build/macos/Build/Products/Debug/flutter_application_1.app/Contents/Frameworks/App.framework: com.apple.FinderInfo:
/Users/adgb/Documents/dev/flutter_application_1/build/macos/Build/Products/Debug/flutter_application_1.app/Contents/Frameworks/App.framework: com.apple.fileprovider.fpfs#P:
/Users/adgb/Documents/dev/flutter_application_1/build/macos/Build/Products/Debug/flutter_application_1.app: com.apple.FinderInfo:
/Users/adgb/Documents/dev/flutter_application_1/build/macos/Build/Products/Debug/flutter_application_1.app: com.apple.fileprovider.fpfs#P:

如果我按照

this
帖子的解决方案 2 运行 ls -alR@ . > kundapura.txt。我得到以下输出:

total 0
drwxr-xr-x@ 4 adgb  staff  128 18 Apr 20:44 .
    com.apple.FinderInfo     32 
    com.apple.fileprovider.fpfs#P     4 
drwxr-xr-x  8 adgb  staff  256 18 Apr 20:27 ..
drwxr-xr-x  7 adgb  staff  224 17 Apr 21:50 Contents
-rw-r--r--  1 adgb  staff    0 18 Apr 20:44 kundapura.txt

./Contents:
total 16
drwxr-xr-x   7 adgb  staff   224 17 Apr 21:50 .
drwxr-xr-x@  4 adgb  staff   128 18 Apr 20:44 ..
    com.apple.FinderInfo      32 
    com.apple.fileprovider.fpfs#P      4 
drwxr-xr-x  21 adgb  staff   672 18 Apr 20:28 Frameworks
-rw-r--r--   1 adgb  staff  1646 17 Apr 21:50 Info.plist
drwxr-xr-x   3 adgb  staff    96 17 Apr 21:50 MacOS
-rw-r--r--   1 adgb  staff     8 17 Apr 21:50 PkgInfo
drwxr-xr-x   5 adgb  staff   160 17 Apr 21:50 Resources

./Contents/Frameworks:
total 21936
drwxr-xr-x  21 adgb  staff      672 18 Apr 20:28 .
drwxr-xr-x   7 adgb  staff      224 17 Apr 21:50 ..
drwxr-xr-x@  5 adgb  staff      160 17 Apr 21:50 App.framework
    com.apple.FinderInfo         32 
    com.apple.fileprovider.fpfs#P         4 
drwxr-xr-x@  5 adgb  staff      160 17 Apr 21:37 FlutterMacOS.framework
    com.apple.FinderInfo         32 
    com.apple.fileprovider.fpfs#P         4 
-rwxr-xr-x   1 adgb  staff   222496 17 Apr 21:50 libswiftAppKit.dylib
-rwxr-xr-x   1 adgb  staff  6456112 17 Apr 21:50 libswiftCore.dylib
-rwxr-xr-x   1 adgb  staff    74960 17 Apr 21:50 libswiftCoreAudio.dylib
-rwxr-xr-x   1 adgb  staff    98688 17 Apr 21:50 libswiftCoreData.dylib
-rwxr-xr-x   1 adgb  staff    41920 17 Apr 21:50 libswiftCoreFoundation.dylib
-rwxr-xr-x   1 adgb  staff   190352 17 Apr 21:50 libswiftCoreGraphics.dylib
-rwxr-xr-x   1 adgb  staff    49856 17 Apr 21:50 libswiftCoreImage.dylib
-rwxr-xr-x   1 adgb  staff    87328 17 Apr 21:50 libswiftCoreMedia.dylib
-rwxr-xr-x   1 adgb  staff    98896 17 Apr 21:50 libswiftDarwin.dylib
-rwxr-xr-x   1 adgb  staff   328080 17 Apr 21:50 libswiftDispatch.dylib
-rwxr-xr-x   1 adgb  staff  3163200 17 Apr 21:50 libswiftFoundation.dylib
-rwxr-xr-x   1 adgb  staff    45456 17 Apr 21:50 libswiftIOKit.dylib
-rwxr-xr-x   1 adgb  staff    84720 17 Apr 21:50 libswiftMetal.dylib
-rwxr-xr-x   1 adgb  staff    62064 17 Apr 21:50 libswiftObjectiveC.dylib
-rwxr-xr-x   1 adgb  staff    58160 17 Apr 21:50 libswiftQuartzCore.dylib
-rwxr-xr-x   1 adgb  staff    45536 17 Apr 21:50 libswiftXPC.dylib
-rwxr-xr-x   1 adgb  staff    72160 17 Apr 21:50 libswiftos.dylib

./Contents/Frameworks/App.framework:
total 0
drwxr-xr-x@  5 adgb  staff  160 17 Apr 21:50 .
    com.apple.FinderInfo     32 
    com.apple.fileprovider.fpfs#P     4 
drwxr-xr-x  21 adgb  staff  672 18 Apr 20:28 ..
lrwxr-xr-x   1 adgb  staff   20 17 Apr 21:50 App -> Versions/Current/App
lrwxr-xr-x   1 adgb  staff   26 17 Apr 21:50 Resources -> Versions/Current/Resources
drwxr-xr-x   4 adgb  staff  128 17 Apr 21:50 Versions

./Contents/Frameworks/App.framework/Versions:
total 0
drwxr-xr-x  4 adgb  staff  128 17 Apr 21:50 .
drwxr-xr-x@ 5 adgb  staff  160 17 Apr 21:50 ..
    com.apple.FinderInfo     32 
    com.apple.fileprovider.fpfs#P     4 
drwxr-xr-x  5 adgb  staff  160 18 Apr 20:28 A
lrwxr-xr-x  1 adgb  staff    1 17 Apr 21:50 Current -> A

./Contents/Frameworks/App.framework/Versions/A:
total 48
drwxr-xr-x  5 adgb  staff    160 18 Apr 20:28 .
drwxr-xr-x  4 adgb  staff    128 17 Apr 21:50 ..
-rwxr-xr-x  1 adgb  staff  22496 18 Apr 20:28 App
drwxr-xr-x  4 adgb  staff    128 17 Apr 21:50 Resources
drwxr-xr-x  3 adgb  staff     96 18 Apr 20:28 _CodeSignature

./Contents/Frameworks/App.framework/Versions/A/Resources:
total 8
drwxr-xr-x   4 adgb  staff  128 17 Apr 21:50 .
drwxr-xr-x   5 adgb  staff  160 18 Apr 20:28 ..
-rw-r--r--   1 adgb  staff  650 17 Apr 21:50 Info.plist
drwxr-xr-x  11 adgb  staff  352 17 Apr 21:50 flutter_assets

./Contents/Frameworks/App.framework/Versions/A/Resources/flutter_assets:
total 93784
drwxr-xr-x  11 adgb  staff       352 17 Apr 21:50 .
drwxr-xr-x   4 adgb  staff       128 17 Apr 21:50 ..
-rw-r--r--   1 adgb  staff         2 17 Apr 21:50 AssetManifest.bin
-rw-r--r--   1 adgb  staff         2 17 Apr 21:50 AssetManifest.json
-rw-r--r--   1 adgb  staff        82 17 Apr 21:50 FontManifest.json
-rw-r--r--   1 adgb  staff     79262 17 Apr 21:50 NOTICES.Z
drwxr-xr-x   3 adgb  staff        96 17 Apr 21:50 fonts
-rw-r--r--   1 adgb  staff  10339218 28 Mar 10:20 isolate_snapshot_data
-rw-r--r--   1 adgb  staff  37560560 17 Apr 21:50 kernel_blob.bin
drwxr-xr-x   3 adgb  staff        96 17 Apr 21:50 shaders
-rw-r--r--   1 adgb  staff     12391 28 Mar 10:20 vm_snapshot_data

./Contents/Frameworks/App.framework/Versions/A/Resources/flutter_assets/fonts:
total 3216
drwxr-xr-x   3 adgb  staff       96 17 Apr 21:50 .
drwxr-xr-x  11 adgb  staff      352 17 Apr 21:50 ..
-rw-rw-r--   1 adgb  staff  1645184  7 Sep  2022 MaterialIcons-Regular.otf

./Contents/Frameworks/App.framework/Versions/A/Resources/flutter_assets/shaders:
total 16
drwxr-xr-x   3 adgb  staff    96 17 Apr 21:50 .
drwxr-xr-x  11 adgb  staff   352 17 Apr 21:50 ..
-rw-r--r--   1 adgb  staff  7192 17 Apr 21:50 ink_sparkle.frag

./Contents/Frameworks/App.framework/Versions/A/_CodeSignature:
total 16
drwxr-xr-x  3 adgb  staff    96 18 Apr 20:28 .
drwxr-xr-x  5 adgb  staff   160 18 Apr 20:28 ..
-rw-r--r--  1 adgb  staff  4902 18 Apr 20:28 CodeResources

./Contents/Frameworks/FlutterMacOS.framework:
total 0
drwxr-xr-x@  5 adgb  staff  160 17 Apr 21:37 .
    com.apple.FinderInfo     32 
    com.apple.fileprovider.fpfs#P     4 
drwxr-xr-x  21 adgb  staff  672 18 Apr 20:28 ..
lrwxr-xr-x   1 adgb  staff   29 17 Apr 21:37 FlutterMacOS -> Versions/Current/FlutterMacOS
lrwxr-xr-x   1 adgb  staff   26 17 Apr 21:37 Resources -> Versions/Current/Resources
drwxr-xr-x   4 adgb  staff  128 28 Mar 10:53 Versions

./Contents/Frameworks/FlutterMacOS.framework/Versions:
total 0
drwxr-xr-x  4 adgb  staff  128 28 Mar 10:53 .
drwxr-xr-x@ 5 adgb  staff  160 17 Apr 21:37 ..
    com.apple.FinderInfo     32 
    com.apple.fileprovider.fpfs#P     4 
drwxr-xr-x  5 adgb  staff  160 18 Apr 20:28 A
lrwxr-xr-x  1 adgb  staff    1 17 Apr 21:37 Current -> A

./Contents/Frameworks/FlutterMacOS.framework/Versions/A:
total 102616
drwxr-xr-x  5 adgb  staff       160 18 Apr 20:28 .
drwxr-xr-x  4 adgb  staff       128 28 Mar 10:53 ..
-rwxr-xr-x  1 adgb  staff  52538272 18 Apr 20:28 FlutterMacOS
drwxr-xr-x  4 adgb  staff       128 28 Mar 10:41 Resources
drwxr-xr-x  3 adgb  staff        96 28 Mar 10:54 _CodeSignature

./Contents/Frameworks/FlutterMacOS.framework/Versions/A/Resources:
total 1608
drwxr-xr-x  4 adgb  staff     128 28 Mar 10:41 .
drwxr-xr-x  5 adgb  staff     160 18 Apr 20:28 ..
-rw-r--r--  1 adgb  staff     717 28 Mar 10:41 Info.plist
-rw-r--r--  1 adgb  staff  817232 28 Mar 10:41 icudtl.dat

./Contents/Frameworks/FlutterMacOS.framework/Versions/A/_CodeSignature:
total 8
drwxr-xr-x  3 adgb  staff    96 28 Mar 10:54 .
drwxr-xr-x  5 adgb  staff   160 18 Apr 20:28 ..
-rw-r--r--  1 adgb  staff  2668 18 Apr 20:28 CodeResources

./Contents/MacOS:
total 144
drwxr-xr-x  3 adgb  staff     96 17 Apr 21:50 .
drwxr-xr-x  7 adgb  staff    224 17 Apr 21:50 ..
-rwxr-xr-x  1 adgb  staff  70520 17 Apr 21:50 flutter_application_1

./Contents/Resources:
total 352
drwxr-xr-x  5 adgb  staff     160 17 Apr 21:50 .
drwxr-xr-x  7 adgb  staff     224 17 Apr 21:50 ..
-rw-r--r--  1 adgb  staff   21421 17 Apr 21:50 AppIcon.icns
-rw-r--r--  1 adgb  staff  153352 17 Apr 21:50 Assets.car
drwxr-xr-x  3 adgb  staff      96 17 Apr 21:50 Base.lproj

./Contents/Resources/Base.lproj:
total 32
drwxr-xr-x  3 adgb  staff     96 17 Apr 21:50 .
drwxr-xr-x  5 adgb  staff    160 17 Apr 21:50 ..
-rw-r--r--  1 adgb  staff  16253 17 Apr 21:50 MainMenu.nib

我用

flutter doctor -v
检查了我的 flutter 安装,没有发现任何问题:

(base) adgb@adgbs-MacBook-Pro ~ % flutter doctor -v
[✓] Flutter (Channel stable, 3.19.5, on macOS 14.4.1 23E224 darwin-x64, locale
    en-AU)
    • Flutter version 3.19.5 on channel stable at
      /Users/adgb/development/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 300451adae (3 weeks ago), 2024-03-27 21:54:07 -0500
    • Engine revision e76c956498
    • Dart version 3.3.3
    • DevTools version 2.31.1

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/adgb/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.9+0-17.0.9b1087.7-11185874)
    • All Android licenses accepted.

[✓] 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.2)
    • 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.9+0-17.0.9b1087.7-11185874)

[✓] VS Code (version 1.88.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.86.0

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-x64     • macOS 14.4.1 23E224 darwin-x64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 123.0.6312.124

[✓] Network resources
    • All expected network resources are available.

• No issues found!

我不知所措,不知道如何解决这个问题以便完成构建。请帮忙!

ios flutter macos dart
1个回答
0
投票

找到this问题后,我弄清楚了它失败的原因:文件正在由iCloud Drive跟踪,这就是

xattr -cr .
无法工作的原因。

在设备中禁用 iCloud Drive 后,它按预期构建。

© www.soinside.com 2019 - 2024. All rights reserved.