[flutter] Packages are not supported when using legacy build locations, but the current project has them enabled.

はじめに

flutterでbuildができなくなってハマった。。。

エラー内容

`flutter run` `flutter build` で下記エラーが発生

% fvm flutter run --flavor development -t lib/main-development.dart -d xxxxxxx
Changing current working directory to: /Users/xxxx/git/app
Launching lib/main-development.dart on iPad in debug mode...
ProcessException: Process exited abnormally:
Command line invocation:
    /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -list

User defaults from command line:
    IDEPackageSupportUseBuiltinSCM = YES

Resolve Package Graph
Packages are not supported when using legacy build locations, but the current project has them enabled.

2023-12-06 09:54:40.537 xcodebuild[17336:1358884] DVTCoreDeviceEnabledState: DVTCoreDeviceEnabledState_Disabled set via user default (DVTEnableCoreDevice=disabled)
2023-12-06 09:54:40.793 xcodebuild[17336:1358884] Writing error result bundle to /var/folders/_t/ny05t5m96kq4rz2kprp6cgpw0000gn/T/ResultBundle_2023-06-12_09-54-0040.xcresult
xcodebuild: error: Could not resolve package dependencies:
  Packages are not supported when using legacy build locations, but the current project has them enabled.
  Command: /usr/bin/arch -arm64e xcrun xcodebuild -list

Legacyビルドになっているよということで、Xcode確認するがXcode Defaultになってる

解決方法

Build Locationを Legacy -> Xcode Default にすることで解消!!

ただし、xcworkspace、xcodeprojファイルを両方やる必要があった

Runner.xcworkspace
File -> Workspace Settings -> Advanced.. -> Xcode Default
Runner.xcodeproj
File -> Project Settings -> Advanced.. -> Xcode Default

おわりに

普段は、workspaceしか開かんからわからんやったわー

コメント

タイトルとURLをコピーしました