我在MacOS上构建Flutter项目时遇到了问题。我现在已经创建了一个全新的flutter项目,在我的pubspec中添加了下面的firebase/firestore包,当在MacOS上构建时,我得到了显示的错误。
我的Mac OS版本是最新的Ventura 13.2.1
。苹果M1芯片
错误:
2 warnings generated.
/Users/alexprice/.pub-cache/hosted/pub.dev/firebase_core-2.13.0/macos/Classes/messages.g.m:9:9: fatal error: 'FlutterMacOS/FlutterMacOS.h' file not found
#import <FlutterMacOS/FlutterMacOS.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
warning: Run script build phase 'Create Symlinks to Header Folders' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'gRPC-Core' from project 'Pods')
warning: Run script build phase 'Create Symlinks to Header Folders' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'gRPC-C++' from project 'Pods')
warning: Run script build phase 'Create Symlinks to Header Folders' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'abseil' from project 'Pods')
warning: Run script build phase 'Create Symlinks to Header Folders' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'Libuv-gRPC' from project 'Pods')
warning: Run script build phase 'Create Symlinks to Header Folders' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'BoringSSL-GRPC' from project 'Pods')
warning: Run script build phase 'Run Script' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'Flutter Assemble' from project 'Runner')
** BUILD FAILED **
运行最新的一切。Flutter 3.10.2
,最新的Xcode。我试过flutter clean
,flutter pub get
,删除锁文件,pod reintegrate
,pod update
,pod repo update
,pod install
..我已经为firebase添加了必要的Google-services json文件,即使它甚至没有读到这里。
Pubspec.yaml
version: 1.0.0+1
environment:
sdk: '>=3.0.1 <4.0.0'
# Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions
# consider running `flutter pub upgrade --major-versions`. Alternatively,
# dependencies can be manually updated by changing the version numbers below to
# the latest version available on pub.dev. To see which dependencies have newer
# versions available, run `flutter pub outdated`.
dependencies:
cloud_firestore: ^4.0.2
firebase_auth: ^4.6.1
firebase_core: ^2.13.0
firebase_storage: ^11.2.1
flutter:
sdk: flutter
flutter_riverpod: ^2.3.6
我甚至对pod文件进行了必要的修改,因此pod构建最小为12.0
:
macOS Pod文件:
platform :osx, '12.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}
def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first"
end
File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\""
end
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
flutter_macos_podfile_setup
target 'Runner' do
use_frameworks!
use_modular_headers!
flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__))
target 'RunnerTests' do
inherit! :search_paths
end
end
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
target.build_configurations.each do |config|
# config.build_settings["EXCLUDED_ARCHS[sdk=macos]"] = "arm64"
config.build_settings['MACOSX_DEPLOYMENT_TARGET'] = '12.0'
config.build_settings['ONLY_ACTIVE_ARCH'] = 'YES'
end
end
end
1条答案
按热度按时间w46czmvw1#
我也是。你找到解决办法了吗?我尝试删除macos文件夹并再次生成它,但错误仍然存在。将platform:osx,'11.0'添加到podfile & pod decintegrate & flutter clean & flutter pub get & pod install。