Cannot build Flutter project through command line after adding Flavor/Xcode Scheme

133 views Asked by At

I followed along with this tutorial to add Flavors to my Flutter project:

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

oddly enough - I am able to run the app through Xcode, but when I try to run the app through Android Studio or terminal via

flutter run --flavor doctor -t lib/main_doctor.dart

The build fails while running the 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 tried:

  1. running flutter clean command
  2. running flutter upgrade command
  3. Removing the pod folder, deintegrating pods, and reinstalling
  4. Deleting ./pub-cache/ folder
  5. Deleting Derived Data & Cocoa Pods Cache
  6. Running flutter pub cache repair cammand
2

There are 2 answers

1
Abdullah On

Try to add these line into your pubspec.yaml folder

     flutter_pusher_client:
        git:
          url: https://github.com/yfer/flutter-pusher-client.git
0
jhenya-d On

Navigate into ios folder and execute such commands.

  1. rm Podfile.lock
  2. rm -rf Pods/
  3. flutter clean
  4. flutter pub get
  5. pod install