Dol*_*hin 15 macos xcode flutter
我正在使用以下命令v3.0.4在 macOS( ) 中构建 flutter( ) macos 应用程序:v12.4 M1 chip
~/fvm/versions/3.0.4/bin/flutter build macos --release\nRun Code Online (Sandbox Code Playgroud)\n显示这样的错误:
\n \xe2\x9e\x9c macos git:(main) \xe2\x9c\x97 ~/fvm/versions/3.0.4/bin/flutter build macos --release --no-tree-shake-icons\nChanging current working directory to: /Users/xiaoqiangjiang/source/reddwarf/frontend/tik\n\n Building with sound null safety \n\nRunning pod install... 668ms\n--- xcodebuild: WARNING: Using the first of multiple matching destinations:\n{ platform:macOS, arch:arm64, id:00006000-001248980AE2801E }\n{ platform:macOS, arch:x86_64, id:00006000-001248980AE2801E }\n/Users/xiaoqiangjiang/source/reddwarf/frontend/tik/macos/Pods/Pods.xcodeproj: warning: The macOS deployment target \'MACOSX_DEPLOYMENT_TARGET\' is set to 10.6, but the range of supported deployment target versions is 10.9 to 12.3.99. (in target \'FMDB\' from project \'Pods\')\nBuilding macOS application...\nRun Code Online (Sandbox Code Playgroud)\n我已经将 Pods 和 Runner 部署目标更改为 10.11。我应该怎么做才能更改MACOSX_DEPLOYMENT_TARGET 版本?这是 macOS 的 podfile:
platform :osx, \'10.11\'\n\n# CocoaPods analytics sends network stats synchronously affecting flutter build latency.\nENV[\'COCOAPODS_DISABLE_STATS\'] = \'true\'\n\nproject \'Runner\', {\n \'Debug\' => :debug,\n \'Profile\' => :release,\n \'Release\' => :release,\n}\n\ndef flutter_root\n generated_xcode_build_settings_path = File.expand_path(File.join(\'..\', \'Flutter\', \'ephemeral\', \'Flutter-Generated.xcconfig\'), __FILE__)\n unless File.exist?(generated_xcode_build_settings_path)\n raise "#{generated_xcode_build_settings_path} must exist. If you\'re running pod install manually, make sure \\"flutter pub get\\" is executed first"\n end\n\n File.foreach(generated_xcode_build_settings_path) do |line|\n matches = line.match(/FLUTTER_ROOT\\=(.*)/)\n return matches[1].strip if matches\n end\n raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \\"flutter pub get\\""\nend\n\nrequire File.expand_path(File.join(\'packages\', \'flutter_tools\', \'bin\', \'podhelper\'), flutter_root)\n\nflutter_macos_podfile_setup\n\ntarget \'Runner\' do\n use_frameworks!\n use_modular_headers!\n\n flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__))\nend\n\npost_install do |installer|\n installer.pods_project.targets.each do |target|\n flutter_additional_macos_build_settings(target)\n end\nend\nRun Code Online (Sandbox Code Playgroud)\n这是 Pods macOS 部署配置:
\n\n我已经尝试清理构建并重建 macos 应用程序,但仍然无法按预期工作。
\n小智 37
进入我的 macos/Podfile 并替换看起来像这样的 post_install 方法 \xe2\x80\xa6
\npost_install do |installer|\n installer.pods_project.targets.each do |target|\n flutter_additional_macos_build_settings(target)\n end\nend\nRun Code Online (Sandbox Code Playgroud)\n看起来像这样。
\npost_install do |installer|\n installer.pods_project.targets.each do |target|\n flutter_additional_macos_build_settings(target)\n target.build_configurations.each do |config|\n config.build_settings[\'MACOSX_DEPLOYMENT_TARGET\'] = \'10.15\'\n end\n end\nend\nRun Code Online (Sandbox Code Playgroud)\n来源:\n https://levelup.gitconnected.com/how-to-fix-your-flutter-macos-target-mismatch-bc55424b7c77
\n希望能帮助到你!
\n经过几个小时寻找解决方案,找到了。
需要在两个地方进行更改,但更改为同一个文件。该文件是 macos/Runner.xcworkspace
在 Finder 中显示它,并使用 XCode 打开。
文件中的第一个更改:运行程序 > 常规 > 最小部署。设置为列表中的最小值或所需值(在我的例子中为 10.13)
文件中的第二个更改:Flutter Assemble > Build Settings > macOS Deployment Target。设置为与之前相同(在我的例子中为 10.13)
要切换到 Flutter Assemble,请使用 Runner 下面的子菜单。这是我的困惑。这 2 个更改需要在同一个文件中进行,并且只需在 Runner 下的上方菜单中选择 Runner 或 Flutter Assemble。也请参阅以下视频,其中包含详细信息
希望这能有所帮助。
| 归档时间: |
|
| 查看次数: |
14321 次 |
| 最近记录: |