dartanalyzer reports errors on the getting started tutorial - dart

Running dartanalyzer on this snipped found on flutter.io/get-started/codelab yields these errors:
$ dartanalyzer lib/main.dart
Analyzing lib/main.dart...
error • The function 'MyApp' isn't defined at lib/main.dart:3:23 • undefined_function
error • 'MaterialApp' isn't a function at lib/main.dart:8:12 • invocation_of_non_function
error • 'Scaffold' isn't a function at lib/main.dart:10:13 • invocation_of_non_function
error • 'AppBar' isn't a function at lib/main.dart:11:17 • invocation_of_non_function
error • 'Text' isn't a function at lib/main.dart:12:18 • invocation_of_non_function
error • 'Center' isn't a function at lib/main.dart:14:15 • invocation_of_non_function
error • 'Text' isn't a function at lib/main.dart:15:18 • invocation_of_non_function
7 errors found.
$ dartanalyzer --version
dartanalyzer version 1.24.3
What can I do to make the analyzer run correct?

For Flutter projects instead of running dartanalyzer you should run flutter analyze. Flutter ships with it's own SDK, so the regular dart analyzer doesn't work without some extra configuration - which that command provides.

Related

Cannot launch Android Studios default "new flutter project" on iOs

I have recently updated multiple components of my system and since then flutter iOS builds don't work anymore.
My plan was to identify the libraries that cause the problems I decided to start with a clean new project and add my required libraries one by one until it fails. The problem is that I cannot even launch a freshly created Android Studio "new flutter project" on the iOs Simulator (or on a real IPhone for that matter).
I have added signing in Xcode 13.2.1 - no further changes.
My system runs on macOS Monterey 12.2.1.
When I try to launch this "virgin" app the Output is:
Launching lib/main.dart on iPhone 13 in debug mode...
Running Xcode build...
Xcode build done. 2.3s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
Writing result bundle at path:
/var/folders/t1/l4k0xxn13vz_ngc05nvytsb40000gn/T/flutter_tools.Gg1WCD/flutter_ios_build_temp_dirCeOcFZ/temporary_xcresult_bundle
While building module 'Foundation' imported from /Users/bernhardpiskernik/StudioProjects/test_20220214/ios/Pods/Target Support Files/Pods-Runner/Pods-Runner-dummy.m:1:
In file included from <module-includes>:1:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:10:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSArray.h:109:12: error: attributes may not be specified on a category
#interface NSArray<ObjectType> (NSArrayDiffing)
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSArray.h:196:12: error: attributes may not be specified on a category
#interface NSMutableArray<ObjectType> (NSMutableArrayDiffing)
^
While building module 'Foundation' imported from /Users/bernhardpiskernik/StudioProjects/test_20220214/ios/Pods/Target Support Files/Pods-Runner/Pods-Runner-dummy.m:1:
In file included from <module-includes>:1:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:12:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSBundle.h:91:143: error: function does not return NSString
- (NSAttributedString *)localizedAttributedStringForKey:(NSString *)key value:(nullable NSString *)value table:(nullable NSString *)tableName NS_FORMAT_ARGUMENT(1) NS_REFINED_FOR_SWIFT API_AVAILABLE(macos(12.0), ios(15.0), watchos(8.0), tvos(15.0));
~~~~~~~~~~~~~~ ^ ~
While building module 'Foundation' imported from /Users/bernhardpiskernik/StudioProjects/test_20220214/ios/Pods/Target Support Files/Pods-Runner/Pods-Runner-dummy.m:1:
In file included from <module-includes>:1:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:8:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:103:48: note: expanded from macro 'NS_FORMAT_ARGUMENT'
#define NS_FORMAT_ARGUMENT(A) __attribute__ ((format_arg(A)))
^ ~
While building module 'Foundation' imported from /Users/bernhardpiskernik/StudioProjects/test_20220214/ios/Pods/Target Support Files/Pods-Runner/Pods-Runner-dummy.m:1:
In file included from <module-includes>:1:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:49:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSKeyValueCoding.h:8:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSOrderedSet.h:112:12: error: attributes may not be specified on a category
#interface NSOrderedSet<ObjectType> (NSOrderedSetDiffing)
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSOrderedSet.h:185:12: error: attributes may not be specified on a category
#interface NSMutableOrderedSet<ObjectType> (NSMutableOrderedSetDiffing)
^
While building module 'Foundation' imported from /Users/bernhardpiskernik/StudioProjects/test_20220214/ios/Pods/Target Support Files/Pods-Runner/Pods-Runner-dummy.m:1:
In file included from <module-includes>:1:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:56:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSMorphology.h:64:12: error: attributes may not be specified on a category
#interface NSMorphology (NSCustomPronouns)
^
While building module 'Foundation' imported from /Users/bernhardpiskernik/StudioProjects/test_20220214/ios/Pods/Target Support Files/Pods-Runner/Pods-Runner-dummy.m:1:
In file included from <module-includes>:1:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:130:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSURLSession.h:500:168: error: expected ')'
- (void)readDataOfMinLength:(NSUInteger)minBytes maxLength:(NSUInteger)maxBytes timeout:(NSTimeInterval)timeout completionHandler:(void (^) (NSData * _Nullable_result data, BOOL atEOF, NSError * _Nullable error))completionHandler;
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSURLSession.h:500:141: note: to match this '('
- (void)readDataOfMinLength:(NSUInteger)minBytes maxLength:(NSUInteger)maxBytes timeout:(NSTimeInterval)timeout completionHandler:(void (^) (NSData * _Nullable_result data, BOOL atEOF, NSError * _Nullable error))completionHandler;
^
7 errors generated.
/Users/bernhardpiskernik/StudioProjects/test_20220214/ios/Pods/Target Support Files/Pods-Runner/Pods-Runner-dummy.m:1:9: fatal error: could not build module 'Foundation'
#import <Foundation/Foundation.h>
~~~~~~~^
8 errors generated.
note: Using new build system
note: Planning
note: Build preparation complete
note: Building targets in dependency order
Result bundle written to path:
/var/folders/t1/l4k0xxn13vz_ngc05nvytsb40000gn/T/flutter_tools.Gg1WCD/flutter_ios_build_temp_dirCeOcFZ/temporary_xcresult_bundle
Parse Issue (Xcode): Attributes may not be specified on a category
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSArray.h:108:11
Parse Issue (Xcode): Attributes may not be specified on a category
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSArray.h:195:11
Semantic Issue (Xcode): Function does not return NSString
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSBundle.h:90:142
Parse Issue (Xcode): Attributes may not be specified on a category
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSOrderedSet.h:111:11
Parse Issue (Xcode): Attributes may not be specified on a category
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSOrderedSet.h:184:11
Parse Issue (Xcode): Attributes may not be specified on a category
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSMorphology.h:63:11
Parse Issue (Xcode): Expected ')'
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSURLSession.h:499:167
Parse Issue (Xcode): Could not build module 'Foundation'
/Users/bernhardpiskernik/StudioProjects/test_20220214/ios/Pods/Target%20Support%20Files/Pods-Runner/Pods-Runner-dummy.m:0:8
Could not build the application for the simulator.
Error launching application on iPhone 13.
flutter doctor -v returns:
[✓] Flutter (Channel stable, 2.10.1, on macOS 12.2.1 21D62 darwin-x64, locale en-AT)
• Flutter version 2.10.1 at /Users/bernhardpiskernik/Library/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision db747aa133 (5 days ago), 2022-02-09 13:57:35 -0600
• Engine revision ab46186b24
• Dart version 2.16.1
• DevTools version 2.9.2
[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
• Android SDK at /Users/bernhardpiskernik/Library/Android/sdk/
• Platform android-32, build-tools 32.1.0-rc1
• Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• CocoaPods version 1.11.2
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2021.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822)
[✓] Connected device (2 available)
• iPhone 13 (mobile) • 32762AE5-1FA2-428D-98DD-998153C83A7E • ios • com.apple.CoreSimulator.SimRuntime.iOS-15-2 (simulator)
• Chrome (web) • chrome • web-javascript • Google Chrome 98.0.4758.80
[✓] HTTP Host Availability
• All required HTTP hosts are available
• No issues found!
What am I missing?
Turns out, I have updated something in my conda base environment that caused the issue.
A conda deactivate was sufficient to successfully run flutter.
To make the run button work again I had to disable the automatic start of the conda base environment by adding conda config --set auto_activate_base false after the conda init block in .zshrc and restarting the MacBook.

Error building iOS app with Flutter - Missing DVTPlugInCompatibilityUUID plugin

I shipped a build before the weekend everything works fine, I come back on Monday, impossible to build. I'm stuck on this for the past few days, I've been trying most of the stuff from the internet I can't seem to find a solution.
XCode build is failing specifying missing plugins (form the base Flutter install I'm guessing):
[ ] Xcode build done. 50.6s
[ ] Failed to build iOS app
[ ] Error output from Xcode build:
↳
[ ] 2021-06-10 09:23:10.255 xcodebuild[64069:7134747] [MT] PluginLoading: Required plug-in compatibility UUID F56A1938-53DE-493D-9D64-87EE6C415E4D for plug-in at path '~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/CocoaPods.xcplugin' not present in DVTPlugInCompatibilityUUIDs
2021-06-10 09:23:10.255 xcodebuild[64069:7134747] [MT] PluginLoading: Required plug-in compatibility UUID F56A1938-53DE-493D-9D64-87EE6C415E4D for plug-in at path '~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/Alcatraz.xcplugin' not present in DVTPlugInCompatibilityUUIDs
** BUILD FAILED **
It then generates error concerning Riverpod
[+5009 ms] ../../flutter/.pub-cache/hosted/pub.dartlang.org/riverpod-0.12.4/lib/src/common.freezed.dart:121:4: Error: Getter not found: 'nullable'.
[ +2 ms] #nullable
[ ] ^^^^^^^^
[ +5 ms] ../../flutter/.pub-cache/hosted/pub.dartlang.org/riverpod-0.12.4/lib/src/common.freezed.dart:121:4: Error: This can't be used as an annotation; an annotation should be a reference to a compile-time constant variable, or a call to a constant constructor.
[ ] #nullable
[ ] ^
[ +1 ms] ../../flutter/.pub-cache/hosted/pub.dartlang.org/riverpod-0.12.4/lib/src/common.freezed.dart:206:4: Error: Getter not found: 'nullable'.
[ ] #nullable
[ ] ^^^^^^^^
[ ] ../../flutter/.pub-cache/hosted/pub.dartlang.org/riverpod-0.12.4/lib/src/common.freezed.dart:206:4: Error: This can't be used as an annotation; an annotation should be a reference to a compile-time constant variable, or a call to a constant constructor.
[ ] #nullable
[ ] ^
What I have tried so far:
flutter clean
flutter pub cache repair
Rebuilding the iOS folder
cleaning the build folder
pod update && pod install
flutter upgrade
check the use of !use_frameworks in podfile
And other configuration changes in XCode such as the script 'for install only', etc...
The only thing I see would be that the problem is coming from a package that I'm using, such as Firebase Core. They had a similar problem a year ago or so where we had to downgrade the package version in order to build and the error was similar, the problem here is that I tried to downgrade from 1.2.1 to 0.7.0 but the problem persists until it generates dependencies issues.
Same kind of issue happended with flutter_svg I think, it was due to a breaking change making it mandatory to either update flutter_svg or downgrade flutter.
Also, could it be that I have not migrated to sound null safety yet ?
If you have an idea on how to debug this, that would be very helpful. (Some stuff that I can run to have more infos regarding the error for example).
Here are my flutter doctor and pubspec files:
Flutter doctor:
[✓] Flutter (Channel stable, 2.2.1, on macOS 11.3 20E232 darwin-x64, locale en-FR)
• Flutter version 2.2.1 at /Users/Wapazz/Development/flutter
• Framework revision 02c026b03c (2 weeks ago), 2021-05-27 12:24:44 -0700
• Engine revision 0fdb562ac8
• Dart version 2.13.1
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at /Users/Wapazz/Library/Android/sdk
• Platform android-30, build-tools 29.0.2
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.5, Build version 12E262
• CocoaPods version 1.10.1
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 3.5)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 42.1.1
• Dart plugin version 191.8593
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
[✓] Connected device (2 available)
• iPhone 11 (mobile) • 519E686E-DEDD-4859-8D8D-EA775DB7149D • ios • com.apple.CoreSimulator.SimRuntime.iOS-14-5 (simulator)
• Chrome (web) • chrome • web-javascript • Google Chrome 91.0.4472.77
• No issues found!
Pubspec.yaml:
dependencies:
flutter:
sdk: flutter
cloud_firestore: ^2.2.2
country_code_picker: ^2.0.1
dropdown_formfield: ^0.1.3
file_picker: ^3.0.2+2
firebase_auth: ^1.4.1
firebase_core: ^1.3.0
firebase_storage: ^8.1.3
flat_segmented_control: ^0.1.0
flutter_dialogs: ^1.1.0
flutter_keyboard_visibility: ^5.0.2
flutter_radar_chart: ^0.2.0
flutter_riverpod: ^0.12.4 #^0.14.0+3
flutter_svg: ^0.22.0
google_fonts: ^2.1.0
image_picker: ^0.8.0+3
introduction_screen: ^2.1.0
modal_bottom_sheet: ^2.0.0
shimmer: ^2.0.0
video_player: ^2.1.6
youtube_player_flutter: ^8.0.0
EDIT: It seems to be coming from riverpod 0.12.4.
Updating it to the latest version generated another error but that requires code refactoring, I will update if the issue is resolved after the refactoring.
After reviewing every dependencies one by one I found the culprit.
The issue was coming from riverpod 0.12.4, updating it to the latest version fixed the issue.
In addition a refactor was necessary in order to make the app working and fix the breaking changes due to the new 0.14.0 version.
Github issue regarding riverpod
Migration guide

No type or protocol named 'FlutterPlugin'

When I try to flutter build ios or just run on iOS simulator, it fails with following error:
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
In file included from
/Users/hh/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.7+3/ios/Classes/FLTShare
dPreferencesPlugin.m:5:
/Users/hh/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.7+3/ios/Classes/FLTShare
dPreferencesPlugin.h:7:51: error: no type or protocol named 'FlutterPlugin'
#interface FLTSharedPreferencesPlugin : NSObject
^
/Users/hh/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.7+3/ios/Classes/FLTShare
dPreferencesPlugin.m:11:41: error: no type or protocol named 'FlutterPluginRegistrar'
(void)registerWithRegistrar:(NSObject *)registrar {
^
/Users/hh/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.7+3/ios/Classes/FLTShare
dPreferencesPlugin.m:12:3: error: use of undeclared identifier 'FlutterMethodChannel'
FlutterMethodChannel *channel = [FlutterMethodChannel methodChannelWithName:CHANNEL_NAME
^
/Users/hh/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.7+3/ios/Classes/FLTShare
dPreferencesPlugin.m:12:25: error: use of undeclared identifier 'channel'
FlutterMethodChannel *channel = [FlutterMethodChannel methodChannelWithName:CHANNEL_NAME
^
/Users/hh/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.7+3/ios/Classes/FLTShare
dPreferencesPlugin.m:12:36: error: use of undeclared identifier 'FlutterMethodChannel'
FlutterMethodChannel *channel = [FlutterMethodChannel methodChannelWithName:CHANNEL_NAME
^
/Users/hh/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.7+3/ios/Classes/FLTShare
dPreferencesPlugin.m:14:4: error: use of undeclared identifier 'channel'
[channel setMethodCallHandler:^(FlutterMethodCall *call, FlutterResult result) {
^
6 errors generated.
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
Encountered error while building for device.
And this is how it looks in xcode
xcode screenshot
Flutter Doctor output:
[✓] Flutter (Channel stable, v1.17.5, on Mac OS X 10.15.4 19E287, locale en-IN)
• Flutter version 1.17.5 at /Users/hh/Developer/flutter
• Framework revision 8af6b2f (3 weeks ago), 2020-06-30 12:53:55 -0700
• Engine revision ee76268252
• Dart version 2.8.4
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at /Users/hh/Library/Android/sdk
• Platform android-29, build-tools 29.0.2
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 11.4.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.4.1, Build version 11E503a
• CocoaPods version 1.9.1
[✓] Android Studio (version 3.5)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 43.0.1
• Dart plugin version 191.8593
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
[✓] Connected device (1 available)
• iPad Pro (12.9-inch) (4th generation) • 7983738B-844D-4B69-98BF-D93F5F3550AB • ios •
com.apple.CoreSimulator.SimRuntime.iOS-13-4 (simulator)
• No issues found!
Please help 🙏🏽

Flutter run - Failed to build iOS app - Command PhaseScriptExecution failed with a nonzero exit code

Here's an image version of the console output for the flutter run.
Here's an image version of the console output for flutter doctor -v.
Running flutter run gives me:
'''Downloading ios tools... 7.8s
Downloading ios-profile tools... 5.5s
Downloading ios-release tools... 34.0s
Launching lib/main.dart on iPhone SE (2nd generation) in debug mode...
Warning: Missing build name (CFBundleShortVersionString).
Warning: Missing build number (CFBundleVersion).
Action Required: You must set a build name and number in the pubspec.yaml file version field before submitting to the App
Store.
Running pod install... 9.3s
Running Xcode build...
Xcode build done. 89.9s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
../.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart:88:26: Error: Type
'DiagnosticableMixin' not found.
class PictureStream with DiagnosticableMixin {
^^^^^^^^^^^^^^^^^^^
../.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart:192:44: Error: Type
'DiagnosticableMixin' not found.
abstract class PictureStreamCompleter with DiagnosticableMixin {
^^^^^^^^^^^^^^^^^^^
../.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart:88:7: Error: The type
'DiagnosticableMixin' can't be mixed in.
class PictureStream with DiagnosticableMixin {
^
../.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart:192:16: Error: The type
'DiagnosticableMixin' can't be mixed in.
abstract class PictureStreamCompleter with DiagnosticableMixin {
^
../.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart:167:11: Error: Superclass has no
method named 'debugFillProperties'.
super.debugFillProperties(properties);
^^^^^^^^^^^^^^^^^^^
../.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart:171:30: Error: The method
'toStringShort' isn't defined for the class 'PictureStreamCompleter'.
- 'PictureStreamCompleter' is from 'package:flutter_svg/src/picture_stream.dart'
('../.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart').
Try correcting the name to the name of an existing method, or defining a method named 'toStringShort'.
ifPresent: _completer?.toStringShort(),
^^^^^^^^^^^^^
../.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart:266:11: Error: Superclass has no
method named 'debugFillProperties'.
super.debugFillProperties(description);
^^^^^^^^^^^^^^^^^^^
Command PhaseScriptExecution failed with a nonzero exit code
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
Could not build the application for the simulator.
Error launching application on iPhone SE (2nd generation).
'''
Running flutter doctor -v gives me:
'''
Downloading android-arm-profile/darwin-x64 tools... 1.1s
Downloading android-arm-release/darwin-x64 tools... 0.9s
Downloading android-arm64-profile/darwin-x64 tools... 1.7s
Downloading android-arm64-release/darwin-x64 tools... 1.0s
Downloading android-x64-profile/darwin-x64 tools... 1.3s
Downloading android-x64-release/darwin-x64 tools... 1.0s
[✓] Flutter (Channel master, 1.20.0-1.0.pre.132, on Mac OS X 10.15.2 19C57, locale en-US)
• Flutter version 1.20.0-1.0.pre.132 at /Users/lesleychang/flutter
• Framework revision 5995661777 (6 hours ago), 2020-06-19 16:15:58 -0700
• Engine revision 676cd566f7
• Dart version 2.9.0 (build 2.9.0-17.0.dev 7e72c9ae7e)
[✗] Android toolchain - develop for Android devices
✗ Unable to locate Android SDK.
Install Android Studio from: https://developer.android.com/studio/index.html
On first launch it will assist you in installing the Android SDK components.
(or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions).
If the Android SDK has been installed to a custom location, set ANDROID_SDK_ROOT to that location.
You may also want to add it to your PATH environment variable.
[✓] Xcode - develop for iOS and macOS (Xcode 11.5)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.5, Build version 11E608c
• CocoaPods version 1.9.3
[!] Android Studio (not installed)
• Android Studio not found; download from https://developer.android.com/studio/index.html
(or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions).
[✓] Connected device (1 available)
• iPhone SE (2nd generation) • 7305F6FC-57BD-4A00-A55D-FC6741E759C4 • ios •
com.apple.CoreSimulator.SimRuntime.iOS-13-5 (simulator)
! Doctor found issues in 2 categories.
'''
I can't run my Flutter app on my iOS emulator at all and I've looked at similar posts to no avail. Any pointers on what to do? Or any other communities I can try getting help from? Thanks!
Due to a breaking change made by https://github.com/flutter/flutter/pull/58635, you can upgrade flutter_svg to 0.18.0 or downgrade flutter otherwise.
upgrade your flutter_svg plugin to
flutter_svg: ^0.19.0

Flutter Error: FIROAuthProvider credentialWithProviderID:provider

I have a flutter built app and would like to add firebase_auth and cloud_firestore. It used to work smoothly. Then I added the following two lines into pubspec.yaml:
firebase_auth: ^0.15.4
cloud_firestore: ^0.13.0+1
and run packages get. Without doing anything else, if I run my project it gives the following error:
Launching lib/main.dart on iPhone 11 Pro Max in debug mode...
Running pod install...
Running Xcode build...
Xcode build done. 132.2s
Failed to build iOS app
Error output from Xcode build:
↳
2020-01-31 14:17:56.015 xcodebuild[41367:4940394] DTDeviceKit: deviceType from 00008006-0007354C3EFA002E was NULL
2020-01-31 14:17:57.763 xcodebuild[41367:4940338] [MT] iPhoneConnect: 📱<DVTiOSDevice (0x7fbdeb156390), Baseduo, iPhone, 13.3.1 (17D5050a), 4be1310269eaf14dd153c6def229bddceaeebbe6> == Underlying device preparation errors ==
2020-01-31 14:17:57.763 xcodebuild[41367:4940338] [MT] iPhoneConnect: 📱<DVTiOSDevice (0x7fbdeb156390), Baseduo, iPhone, 13.3.1 (17D5050a), 4be1310269eaf14dd153c6def229bddceaeebbe6> -- Failed _shouldMakeReadyForDevelopment check even though device is not locked by passcode.
Domain: com.apple.platform.iphoneos
Code: 5
Failure Reason: allowsSecureServices: 1. isConnected: 0. Platform: <DVTPlatform:0x7fbde662bd20:'com.apple.platform.iphoneos':<DVTFilePath:0x7fbde662bca0:'/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform'>>. DTDKDeviceIdentifierIsIDID: 0
--
2020-01-31 14:17:57.763 xcodebuild[41367:4940338] [MT] iPhoneConnect: 📱<DVTiOSDevice (0x7fbdeb156390), Baseduo, iPhone, 13.3.1 (17D5050a), 4be1310269eaf14dd153c6def229bddceaeebbe6> == END: Underlying device preparation errors ==
** BUILD FAILED **
Xcode's output:
↳
/Users/Baseduo/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.15.4/ios/Classes/FLTFirebaseAuthPlugin.m:505:38: error: no known class method for selector 'credentialWithProviderID:IDToken:rawNonce:accessToken:'
credential = [FIROAuthProvider credentialWithProviderID:provider
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/Baseduo/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.15.4/ios/Classes/FLTFirebaseAuthPlugin.m:514:38: error: no known class method for selector 'credentialWithProviderID:IDToken:rawNonce:'
credential = [FIROAuthProvider credentialWithProviderID:provider
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 errors generated.
Command CompileSwift failed with a nonzero exit code
Command CompileSwift failed with a nonzero exit code
Command CompileSwift failed with a nonzero exit code
Command CompileSwift failed with a nonzero exit code
Command CompileSwift failed with a nonzero exit code
note: Using new build system
note: Planning build
note: Constructing build description
Could not build the application for the simulator.
Error launching application on iPhone 11 Pro Max.
There is also no response on Flutter Doctor:
/Users/Baseduo/Developer/flutter/bin/flutter doctor --verbose
[✓] Flutter (Channel stable, v1.12.13+hotfix.7, on Mac OS X 10.15.2 19C57, locale en-TR)
• Flutter version 1.12.13+hotfix.7 at /Users/Baseduo/Developer/flutter
• Framework revision 9f5ff2306b (4 days ago), 2020-01-26 22:38:26 -0800
• Engine revision a67792536c
• Dart version 2.7.0
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.0)
• Android SDK at /Users/Baseduo/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.0
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[✓] Xcode - develop for iOS and macOS (Xcode 11.3.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.3.1, Build version 11C504
• CocoaPods version 1.9.0.beta.2
[✓] Android Studio (version 3.5)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 42.1.1
• Dart plugin version 191.8593
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
[✓] Connected device (2 available)
• Baseduo • 4be1310269eaf14dd153c6def229bddceaeebbe6 • ios • iOS 13.3.1
• iPhone 11 Pro Max • 954398E8-1CB7-4189-B2E6-84E9F87BB94A • ios • com.apple.CoreSimulator.SimRuntime.iOS-13-3 (simulator)
! Doctor found issues in 1 category.
Process finished with exit code 0
I could not find any action to resolve that and appreciate for your answer.
Thank you,
ps: I have used the same action into my other apps and no problem exists.
ps2: It works for Android emulator.
Running pod update in the ios directory fixes the problem (at least until next time). See this bug report.

Resources