添加Flavor/Xcode方案后,无法通过命令行构建Flutter项目



我按照本教程将flavor添加到我的Flutter项目中:

https://sebastien-arbogast.com/2022/05/02/multi-environment-flutter-projects-with-flavors/

很奇怪-我能够通过Xcode运行应用程序,但当我试图通过Android Studio或终端通过

运行应用程序时flutter run --flavor doctor -t lib/main_doctor.dart

运行xcode build时构建失败:


Error output from Xcode build:
↳
** BUILD FAILED **

Xcode's output:
↳
Writing result bundle at path:
/var/folders/8k/shgdr8gj3gn9lzsh9rlpsxn00000gn/T/flutter_tools.AJouME/flutter_ios_build_temp_dircFYIpM/temporary_xcresult_bundle
/Users/macbook/.pub-cache/hosted/pub.dartlang.org/geocoding-2.0.4/ios/Classes/Extensions/CLPlacemarkExtensions.m:22:18: warning: 'addressDictionary' is deprecated: first deprecated in iOS 11.0 - Use @properties [-Wdeprecated-declarations]
if (self.addressDictionary != nil) {
^
In module 'CoreLocation' imported from /Users/macbook/.pub-cache/hosted/pub.dartlang.org/geocoding-2.0.4/ios/Classes/Extensions/CLPlacemarkExtensions.h:10:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.1.sdk/System/Library/Frameworks/CoreLocation.framework/Headers/CLPlacemark.h:76:63: note: 'addressDictionary' has been explicitly marked deprecated here
@property (nonatomic, readonly, copy, nullable) NSDictionary *addressDictionary API_DEPRECATED("Use @properties", macos(10.8, 10.13), ios(5.0, 11.0), watchos(1.0, 4.0));
^
/Users/macbook/.pub-cache/hosted/pub.dartlang.org/geocoding-2.0.4/ios/Classes/Extensions/CLPlacemarkExtensions.m:23:29: warning: 'addressDictionary' is deprecated: first deprecated in iOS 11.0 - Use @properties [-Wdeprecated-declarations]
street = [[self addressDictionary] objectForKey:(NSString *)kABPersonAddressStreetKey];
^
In module 'CoreLocation' imported from /Users/macbook/.pub-cache/hosted/pub.dartlang.org/geocoding-2.0.4/ios/Classes/Extensions/CLPlacemarkExtensions.h:10:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.1.sdk/System/Library/Frameworks/CoreLocation.framework/Headers/CLPlacemark.h:76:63: note: property 'addressDictionary' is declared deprecated here
@property (nonatomic, readonly, copy, nullable) NSDictionary *addressDictionary API_DEPRECATED("Use @properties", macos(10.8, 10.13), ios(5.0, 11.0), watchos(1.0, 4.0));
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.1.sdk/System/Library/Frameworks/CoreLocation.framework/Headers/CLPlacemark.h:76:63: note: 'addressDictionary' has been explicitly marked deprecated here
/Users/macbook/.pub-cache/hosted/pub.dartlang.org/geocoding-2.0.4/ios/Classes/Extensions/CLPlacemarkExtensions.m:23:73: warning: 'kABPersonAddressStreetKey' is deprecated: first deprecated in iOS 9.0 - use CNPostalAddress.street [-Wdeprecated-declarations]
street = [[self addressDictionary] objectForKey:(NSString *)kABPersonAddressStreetKey];
^
In module 'AddressBook' imported from /Users/macbook/.pub-cache/hosted/pub.dartlang.org/geocoding-2.0.4/ios/Classes/Extensions/CLPlacemarkExtensions.m:8:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.1.sdk/System/Library/Frameworks/AddressBook.framework/Headers/ABPerson.h:113:29: note: 'kABPersonAddressStreetKey' has been explicitly marked deprecated here
AB_EXTERN const CFStringRef kABPersonAddressStreetKey AB_DEPRECATED("use CNPostalAddress.street");
^
3 warnings generated.
/Users/macbook/.pub-cache/hosted/pub.dartlang.org/geocoding-2.0.4/ios/Classes/Extensions/CLPlacemarkExtensions.m:22:18: warning: 'addressDictionary' is deprecated: first deprecated in iOS 11.0 - Use @properties [-Wdeprecated-declarations]
if (self.addressDictionary != nil) {
^
In module 'CoreLocation' imported from /Users/macbook/.pub-cache/hosted/pub.dartlang.org/geocoding-2.0.4/ios/Classes/Extensions/CLPlacemarkExtensions.h:10:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.1.sdk/System/Library/Frameworks/CoreLocation.framework/Headers/CLPlacemark.h:76:63: note: 'addressDictionary' has been explicitly marked deprecated here
@property (nonatomic, readonly, copy, nullable) NSDictionary *addressDictionary API_DEPRECATED("Use @properties", macos(10.8, 10.13), ios(5.0, 11.0), watchos(1.0, 4.0));
^
/Users/macbook/.pub-cache/hosted/pub.dartlang.org/geocoding-2.0.4/ios/Classes/Extensions/CLPlacemarkExtensions.m:23:29: warning: 'addressDictionary' is deprecated: first deprecated in iOS 11.0 - Use @properties [-Wdeprecated-declarations]
street = [[self addressDictionary] objectForKey:(NSString *)kABPersonAddressStreetKey];
^
In module 'CoreLocation' imported from /Users/macbook/.pub-cache/hosted/pub.dartlang.org/geocoding-2.0.4/ios/Classes/Extensions/CLPlacemarkExtensions.h:10:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.1.sdk/System/Library/Frameworks/CoreLocation.framework/Headers/CLPlacemark.h:76:63: note: property 'addressDictionary' is declared deprecated here
@property (nonatomic, readonly, copy, nullable) NSDictionary *addressDictionary API_DEPRECATED("Use @properties", macos(10.8, 10.13), ios(5.0, 11.0), watchos(1.0, 4.0));
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.1.sdk/System/Library/Frameworks/CoreLocation.framework/Headers/CLPlacemark.h:76:63: note: 'addressDictionary' has been explicitly marked deprecated here
/Users/macbook/.pub-cache/hosted/pub.dartlang.org/geocoding-2.0.4/ios/Classes/Extensions/CLPlacemarkExtensions.m:23:73: warning: 'kABPersonAddressStreetKey' is deprecated: first deprecated in iOS 9.0 - use CNPostalAddress.street [-Wdeprecated-declarations]
street = [[self addressDictionary] objectForKey:(NSString *)kABPersonAddressStreetKey];
^
In module 'AddressBook' imported from /Users/macbook/.pub-cache/hosted/pub.dartlang.org/geocoding-2.0.4/ios/Classes/Extensions/CLPlacemarkExtensions.m:8:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.1.sdk/System/Library/Frameworks/AddressBook.framework/Headers/ABPerson.h:113:29: note: 'kABPersonAddressStreetKey' has been explicitly marked deprecated here
AB_EXTERN const CFStringRef kABPersonAddressStreetKey AB_DEPRECATED("use CNPostalAddress.street");
^
3 warnings generated.
/Users/macbook/.pub-cache/hosted/pub.dartlang.org/location-4.4.0/ios/Classes/LocationPlugin.m:176:13: warning: 'UIAlertView' is deprecated: first deprecated in iOS 9.0 - UIAlertView is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleAlert instead [-Wdeprecated-declarations]
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Location is Disabled"
^
In module 'UIKit' imported from /Users/macbook/Code/bookmd_flutter/ios/Pods/Target Support Files/location/location-prefix.pch:2:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.1.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIAlertView.h:27:12: note: 'UIAlertView' has been explicitly marked deprecated here
@interface UIAlertView : UIView
^
/Users/macbook/.pub-cache/hosted/pub.dartlang.org/location-4.4.0/ios/Classes/LocationPlugin.m:176:48: warning: 'UIAlertView' is deprecated: first deprecated in iOS 9.0 - UIAlertView is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleAlert instead [-Wdeprecated-declarations]
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Location is Disabled"
^
In module 'UIKit' imported from /Users/macbook/Code/bookmd_flutter/ios/Pods/Target Support Files/location/location-prefix.pch:2:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.1.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIAlertView.h:27:12: note: 'UIAlertView' has been explicitly marked deprecated here
@interface UIAlertView : UIView
^
2 warnings generated.
/Users/macbook/.pub-cache/hosted/pub.dartlang.org/location-4.4.0/ios/Classes/LocationPlugin.m:176:13: warning: 'UIAlertView' is deprecated: first deprecated in iOS 9.0 - UIAlertView is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleAlert instead [-Wdeprecated-declarations]
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Location is Disabled"
^
In module 'UIKit' imported from /Users/macbook/Code/bookmd_flutter/ios/Pods/Target Support Files/location/location-prefix.pch:2:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.1.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIAlertView.h:27:12: note: 'UIAlertView' has been explicitly marked deprecated here
@interface UIAlertView : UIView
^
/Users/macbook/.pub-cache/hosted/pub.dartlang.org/location-4.4.0/ios/Classes/LocationPlugin.m:176:48: warning: 'UIAlertView' is deprecated: first deprecated in iOS 9.0 - UIAlertView is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleAlert instead [-Wdeprecated-declarations]
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Location is Disabled"
^
In module 'UIKit' imported from /Users/macbook/Code/bookmd_flutter/ios/Pods/Target Support Files/location/location-prefix.pch:2:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.1.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIAlertView.h:27:12: note: 'UIAlertView' has been explicitly marked deprecated here
@interface UIAlertView : UIView
^
2 warnings generated.
Failed to package /Users/macbook/Code/bookmd_flutter.
Command PhaseScriptExecution failed with a nonzero exit code
note: Building targets in dependency order
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 'Runner' from project 'Runner')
warning: Run script build phase 'Thin Binary' 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 'Runner' from project 'Runner')
/Users/macbook/Code/bookmd_flutter/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 11.0 to 16.1.99. (in target 'PhoneNumberKit' from project 'Pods')
/Users/macbook/Code/bookmd_flutter/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 11.0 to 16.1.99. (in target 'GoogleMaps' from project 'Pods')
Result bundle written to path:
/var/folders/8k/shgdr8gj3gn9lzsh9rlpsxn00000gn/T/flutter_tools.AJouME/flutter_ios_build_temp_dircFYIpM/temporary_xcresult_bundle

Could not build the application for the simulator.
Error launching application on iPhone 14 Pro Max.

I have try:

  1. 运行flutter clean命令
  2. runningflutter upgradecommand
  3. 删除pod文件夹,分解pod,并重新安装
  4. 删除./pub-cache/文件夹
  5. 删除衍生数据&可可荚缓存
  6. 运行flutter pub cache repair命令

尝试将这些行添加到您的pubspec.yaml文件夹

flutter_pusher_client:
git:
url: https://github.com/yfer/flutter-pusher-client.git

最新更新