iOS Multiple Environment Issue After Upgrade to Flutter 1.17.1 - ios

I have been getting this error since I upgraded to Flutter 1.17.1 few days ago...I tried cleaning the project and switch back to the Legacy build system in Xcode but still getting the same issue.
My project has been using this method to handle multiple environments and it was working perfectly until I upgraded few days ago.
https://medium.com/#animeshjain/build-flavors-in-flutter-android-and-ios-with-different-firebase-projects-per-flavor-27c5c5dac10b
Help is definitely appreciated!
Xcode's output:
↳
error: Multiple commands produce '/Users/ivanchau/AndroidStudioProjects/fella/build/ios/Debug-development-iphonesimulator/Runner.app/GoogleService-Info.plist':
1) Target 'Runner' (project 'Runner') has copy command from '/Users/ivanchau/AndroidStudioProjects/fella/ios/Runner/Firebase/development/GoogleService-Info.plist' to '/Users/ivanchau/AndroidStudioProjects/fella/build/ios/Debug-development-iphonesimulator/Runner.app/GoogleService-Info.plist'
2) Target 'Runner' (project 'Runner') has copy command from '/Users/ivanchau/AndroidStudioProjects/fella/ios/Runner/Firebase/production/GoogleService-Info.plist' to '/Users/ivanchau/AndroidStudioProjects/fella/build/ios/Debug-development-iphonesimulator/Runner.app/GoogleService-Info.plist'
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
warning: duplicate output file '/Users/ivanchau/AndroidStudioProjects/fella/build/ios/Debug-development-iphonesimulator/Runner.app/GoogleService-Info.plist' on task: CopyPlistFile /Users/ivanchau/AndroidStudioProjects/fella/build/ios/Debug-development-iphonesimulator/Runner.app/GoogleService-Info.plist /Users/ivanchau/AndroidStudioProjects/fella/ios/Runner/Firebase/production/GoogleService-Info.plist (in target 'Runner' from project 'Runner')
warning: Mapping architecture armv7 to i386. Ensure that this target's Architectures and Valid Architectures build settings are configured correctly for the iOS Simulator platform. (in target 'image_picker' from project 'Pods')
warning: Mapping architecture arm64 to x86_64. Ensure that this target's Architectures and Valid Architectures build settings are configured correctly for the iOS Simulator platform. (in target 'image_picker' from project 'Pods')
[✓] Flutter (Channel stable, v1.17.1, on Mac OS X 10.15.4 19E287, locale en-CA)
• Flutter version 1.17.1 at /Users/ivanchau/Documents/flutter
• Framework revision f7a6a7906b (4 days ago), 2020-05-12 18:39:00 -0700
• Engine revision 6bc433c6b6
• Dart version 2.8.2
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at /Users/ivanchau/Library/Android/sdk
• Platform android-29, build-tools 28.0.3
• ANDROID_HOME = /Users/ivanchau/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
• 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.8.4
[✓] Android Studio (version 3.6)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 45.1.1
• Dart plugin version 192.8052
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
[✓] Connected device (1 available)
• iPhone 11 Pro • 357DAB56-8A57-4AB3-A319-0FC1EBCA1515 • ios • com.apple.CoreSimulator.SimRuntime.iOS-13-4 (simulator)
• No issues found!

In build phases (after openning your project/ Runner.xcworkspace. in Xcode) check the build phase called 'Copy bundle Resources' and remove the 2*n lines copying your GoogleService-info.plist per environment.
This supposes that you have a custom script that, depending of the flavour/ Scheme will copy the right file.

I am using the similar method for different flavor. I can build for Android but cannot build for iOS anymore after upgrade to Flutter 1.17.1 and xcode 11.5
It says in your error that you have duplicates. Did you use the following command?
flutter run --flavor yourflavor

Related

Cannot compile flutter app for iOS due to 'Flutter/Flutter.h' file not found error

I'm working on a flutter app, as part of a team, and we recently decided to add Share Extension to our app to allow iOS users to share media from outside the app.
After adding the Share Extension, I was able to compile the app and run it. But sometime after that (switching to different git branches) I started getting this error persistently:
Writing result bundle at path:
/var/folders/m4/2cb6zdx138q5z5x0ljnvmygm0000gn/T/flutter_tools.VWykU0/flutter_ios_build_temp_dirylPO5Z/temporary_xcresult_bundle
/Users/jyotiproy/IdeaProjects/krew_app/ios/Runner/Runner-Bridging-Header.h:1:9: note: in file included from /Users/jyotiproy/IdeaProjects/krew_app/ios/Runner/Runner-Bridging-Header.h:1:
#import "GeneratedPluginRegistrant.h"
^
/Users/jyotiproy/IdeaProjects/krew_app/ios/Runner/GeneratedPluginRegistrant.h:10:9: error: 'Flutter/Flutter.h' file not found
#import <Flutter/Flutter.h>
^
1 error generated.
<unknown>:0: error: failed to emit precompiled header '/Users/jyotiproy/Library/Developer/Xcode/DerivedData/Runner-bgkxbehdnpdmkjfwhnujcqssvqjc/Build/Intermediates.noindex/PrecompiledHeaders/Runner-Bridging-Header-swift_2R9KITIRJQAWU-clang_13QX7MSDXGS1W.pch' for bridging header '/Users/jyotiproy/IdeaProjects/krew_app/ios/Runner/Runner-Bridging-Header.h'
/Users/jyotiproy/IdeaProjects/krew_app/ios/Runner/Runner-Bridging-Header.h:1:9: note: in file included from /Users/jyotiproy/IdeaProjects/krew_app/ios/Runner/Runner-Bridging-Header.h:1:
#import "GeneratedPluginRegistrant.h"
^
2 errors generated.
error: generate-pch command failed with exit code 1 (use -v to see invocation)
note: Using new build system
note: Planning
note: Build preparation complete
note: Building targets in dependency order
/Users/jyotiproy/IdeaProjects/krew_app/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 15.4.99. (in target 'TOCropViewController' from project 'Pods')
/Users/jyotiproy/IdeaProjects/krew_app/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 15.4.99. (in target 'Reachability' from project 'Pods')
/Users/jyotiproy/IdeaProjects/krew_app/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 15.4.99. (in target 'OrderedSet' from project 'Pods')
/Users/jyotiproy/IdeaProjects/krew_app/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 15.4.99. (in target 'FMDB' from project 'Pods')
/Users/jyotiproy/IdeaProjects/krew_app/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 15.4.99. (in target 'TOCropViewController-TOCropViewControllerBundle' from project 'Pods')
Result bundle written to path:
/var/folders/m4/2cb6zdx138q5z5x0ljnvmygm0000gn/T/flutter_tools.VWykU0/flutter_ios_build_temp_dirylPO5Z/temporary_xcresult_bundle
Could not build the precompiled application for the device.
Error (Xcode): 'Flutter/Flutter.h' file not found
/Users/jyotiproy/IdeaProjects/krew_app/ios/Runner/GeneratedPluginRegistrant.h:9:8
Error (Xcode): failed to emit precompiled header '/Users/jyotiproy/Library/Developer/Xcode/DerivedData/Runner-bgkxbehdnpdmkjfwhnujcqssvqjc/Build/Intermediates.noindex/PrecompiledHeaders/Runner-Bridging-Header-swift_2R9KITIRJQAWU-clang_13QX7MSDXGS1W.pch' for bridging header '/Users/jyotiproy/IdeaProjects/krew_app/ios/Runner/Runner-Bridging-Header.h'
Error launching application on Krew iPhone.
I've tried some solutions to this error that I found here on SO, like: This one, that suggests removing the ios folder and recreating the project and this one
I've found success once with the first solution (deleting the ios folder), but when I recently tried it again, it didn't work.
I am currently on Xcode 13.3 and below is the output of flutter doctor.
❯ flutter doctor -v
[✓] Flutter (Channel stable, 3.0.0, on macOS 12.2 21D49 darwin-x64, locale en-GB)
• Flutter version 3.0.0 at /Volumes/macOS_Ext/Library/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision ee4e09cce0 (6 weeks ago), 2022-05-09 16:45:18 -0700
• Engine revision d1b9a6938a
• Dart version 2.17.0
• DevTools version 2.12.2
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at /Volumes/macOS_Ext/Library/Android
• Platform android-31, build-tools 30.0.3
• Java binary at: /Library/Java/JavaVirtualMachines/corretto-11.0.13/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment Corretto-11.0.13.8.1 (build 11.0.13+8-LTS)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 13.3)
• 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.2)
• Android Studio at /Volumes/macOS_Ext/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.12+0-b1504.28-7817840)
[✓] IntelliJ IDEA Community Edition (version 2022.1.2)
• IntelliJ at /Applications/IntelliJ IDEA CE.app
• Flutter plugin version 68.1.4
• Dart plugin version 221.5787.37
[✓] VS Code (version 1.68.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.42.0
[✓] Connected device (2 available)
• macOS (desktop) • macos • darwin-x64 • macOS 12.2 21D49 darwin-x64
• Chrome (web) • chrome • web-javascript • Google Chrome 102.0.5005.115
[✓] HTTP Host Availability
• All required HTTP hosts are available
• No issues found!
I'm adding a link to our project's Podfile (as requested in the comments). It can be found here.
I finally solved the issue using this answer. Now I have mentioned in my question that this method was not working for me and I think I understand why.
After recreating the ios folder, I used to do a git rollback to "un-delete" the icons and some xcode project settings. But that was what I did wrong. What one's supposed to do instead is start with a fresh ios folder and add the necessary files and settings manually (also double-checking them in the process) in xcode. After I did that, I was able to compile the app. Hope this helps someone in the same situation.

Command PhaseScriptExecution failed with a nonzero exit code when flutter run in debug

I have a Flutter project which runs perfectly in v2.3.3. I upgraded the flutter version to 3.0.0 in order to use null safety feature. I solved every errors. However when I ran the project, I got Command PhaseScriptExecution failed with a nonzero exit code error. I couldn't find any reasonable and logical solutions throughout internet. Could you please help me on this issue?
Launching lib/main.dart on iPhone SE (3rd generation) in debug mode...
Running pod install... 5.7s
Running Xcode build...
Xcode build done. 18.1s
Failed to build iOS app
Error output from Xcode build:
↳
2022-05-16 15:32:57.974 xcodebuild[72650:368105] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionSentinelHostApplications for extension
Xcode.DebuggerFoundation.AppExtensionHosts.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
2022-05-16 15:32:57.974 xcodebuild[72650:368105] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionPointIdentifierToBundleIdentifier for extension
Xcode.DebuggerFoundation.AppExtensionToBundleIdentifierMap.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
** BUILD FAILED **
Xcode's output:
↳
Writing result bundle at path:
/var/folders/00/r0s0tm0x1s33__6xjw2fml1r0000gn/T/flutter_tools.EYRty2/flutter_ios_build_temp_dir7bCY7C/temporary_xcresult_bundle
ld: warning: linking against a dylib which is not safe for use in application extensions:
/Users/****/Projects/ES.Online.Mobile/build/ios/Debug-iphonesimulator/XCFrameworkIntermediates/InsiderMobileAdvancedNotification/InsiderMobileAdvancedNotification.framework/Ins
iderMobileAdvancedNotification
ld: warning: linking against a dylib which is not safe for use in application extensions:
/Users/****/Projects/ES.Online.Mobile/build/ios/Debug-iphonesimulator/XCFrameworkIntermediates/InsiderMobileAdvancedNotification/InsiderMobileAdvancedNotification.framework/Ins
iderMobileAdvancedNotification
ld: warning: linking against a dylib which is not safe for use in application extensions:
/Users/****/Projects/ES.Online.Mobile/build/ios/Debug-iphonesimulator/XCFrameworkIntermediates/InsiderMobileAdvancedNotification/InsiderMobileAdvancedNotification.framework/Ins
iderMobileAdvancedNotification
ld: warning: linking against a dylib which is not safe for use in application extensions:
/Users/****/Projects/ES.Online.Mobile/build/ios/Debug-iphonesimulator/XCFrameworkIntermediates/InsiderMobileAdvancedNotification/InsiderMobileAdvancedNotification.framework/Ins
iderMobileAdvancedNotification
Failed to package /Users/****/Projects/ES.Online.Mobile.
Command PhaseScriptExecution failed with a nonzero exit code
note: Using new build system
note: Planning
note: Build preparation complete
note: Building targets in dependency order
/Users/****/Projects/ES.Online.Mobile/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of
supported deployment target versions is 9.0 to 15.4.99. (in target 'ReachabilitySwift' from project 'Pods')
/Users/****/Projects/ES.Online.Mobile/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of
supported deployment target versions is 9.0 to 15.4.99. (in target 'FMDB' from project 'Pods')
Result bundle written to path:
/var/folders/00/r0s0tm0x1s33__6xjw2fml1r0000gn/T/flutter_tools.EYRty2/flutter_ios_build_temp_dir7bCY7C/temporary_xcresult_bundle
Could not build the application for the simulator.
Error launching application on iPhone SE (3rd generation).
flutter doctor -v output:
[✓] Flutter (Channel stable, 3.0.0, on macOS 12.3.1 21E258 darwin-x64, locale en-TR)
• Flutter version 3.0.0 at /Users/****/Developer/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision ee4e09cce0 (7 days ago), 2022-05-09 16:45:18 -0700
• Engine revision d1b9a6938a
• Dart version 2.17.0
• DevTools version 2.12.2
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at /Users/****/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 13.3.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• CocoaPods version 1.11.3
[✓] 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 41.1.2
• Dart plugin version 191.8593
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
[✓] VS Code (version 1.67.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.40.0
[✓] Connected device (3 available)
• iPhone SE (3rd generation) (mobile) • 33A8F736-A4EA-41E7-8567-408A051F9952 • ios • com.apple.CoreSimulator.SimRuntime.iOS-15-4 (simulator)
• macOS (desktop) • macos • darwin-x64 • macOS 12.3.1 21E258 darwin-x64
• Chrome (web) • chrome • web-javascript • Google Chrome 101.0.4951.64
[✓] HTTP Host Availability
• All required HTTP hosts are available
• No issues found!
I faced the same issue and resolved it by upgrading a package. Within the spam of warning logs, there was one line that mentioned "Error" instead of "Warning", due to parameter change e.g. in my case for a TextField. I saw the package had an updated version for Flutter 3.0 and reran after upgrading. The warning logs will be still there, but you're app should be running afterwards.
Check for Errors within the Warning Logs thrown by Packages from your pubspec.yaml
I have same issue and I solved in this way:
Update MacOS
Update Xcode and command lines tools
Run flutter pub upgrade, flutter pub get in the project folder
Delete podfile.lock in ios folder of the project
Run cd ios, pod repo update, pod install in the project folder

flutter run does not work on iOS Simulator but Xcode can build

In my Flutter project, flutter run command cannot build project to iOS Simulator but in Xcode when I click build button, Xcode can build it with no problem. I'm using AgoraRTC libraries. After adding Flutter Quill this happened. I deleted all derived datas. Cleaned build folder. Did flutter clean. Rm ios/podfile then pod install, upgrade dependencies etc. but none of them solved my problem.
Do you know how to fix this problem?
flutter doctor -v result
[✓] Flutter (Channel stable, 2.2.2, on macOS 11.4 20F71 darwin-x64, locale en-GB)
• Flutter version 2.2.2 at /Users/user/development/flutter
• Framework revision d79295af24 (3 weeks ago), 2021-06-11 08:56:01 -0700
• Engine revision 91c9fc8fe0
• Dart version 2.13.3
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at /Users/user/Library/Android/sdk
• Platform android-30, build-tools 30.0.3
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)
✗ Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.
[✓] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.5.1, Build version 12E507
• CocoaPods version 1.10.1
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 4.2)
• 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.8+10-b944.6916264)
[✓] VS Code (version 1.57.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.23.0
[✓] Connected device (2 available)
• iPhone 12 Pro Max (mobile) • 51D141E2-C032-43E0-A6F8-0E6C24D78AEC • ios • com.apple.CoreSimulator.SimRuntime.iOS-14-5 (simulator)
• Chrome (web) • chrome • web-javascript • Google Chrome 91.0.4472.114
warning: [CP] Unable to find matching .xcframework slice in '/Users/user/AndroidStudioProjects/projectx/ios/Pods/AgoraRtcEngine_iOS/AgoraAIDenoiseExtension.xcframework AgoraAIDenoiseExtension framework
ios-armv7_arm64 ios-x86_64-simulator' for the current build architectures (arm64 x86_64 i386).
warning: [CP] Unable to find matching .xcframework slice in '/Users/user/AndroidStudioProjects/projectx/ios/Pods/AgoraRtcEngine_iOS/AgoraRtcKit.xcframework AgoraRtcKit framework ios-x86_64-simulator
ios-armv7_arm64' for the current build architectures (arm64 x86_64 i386).
warning: [CP] Unable to find matching .xcframework slice in '/Users/user/AndroidStudioProjects/projectx/ios/Pods/AgoraRtcEngine_iOS/Agoraffmpeg.xcframework Agoraffmpeg framework ios-armv7_arm64
ios-x86_64-simulator' for the current build architectures (arm64 x86_64 i386).
warning: [CP] Unable to find matching .xcframework slice in '/Users/user/AndroidStudioProjects/projectx/ios/Pods/AgoraRtcEngine_iOS/AgoraCore.xcframework AgoraCore framework ios-armv7_arm64
ios-x86_64-simulator' for the current build architectures (arm64 x86_64 i386).
warning: [CP] Unable to find matching .xcframework slice in '/Users/user/AndroidStudioProjects/projectx/ios/Pods/AgoraRtcEngine_iOS/AgoraSoundTouch.xcframework AgoraSoundTouch framework ios-x86_64-simulator
ios-armv7_arm64' for the current build architectures (arm64 x86_64 i386).
warning: [CP] Unable to find matching .xcframework slice in '/Users/user/AndroidStudioProjects/projectx/ios/Pods/AgoraRtcEngine_iOS/Agorafdkaac.xcframework Agorafdkaac framework ios-x86_64-simulator
ios-armv7_arm64' for the current build architectures (arm64 x86_64 i386).
warning: [CP] Unable to find matching .xcframework slice in '/Users/user/AndroidStudioProjects/projectx/ios/Pods/AgoraRtcEngine_iOS/AgoraDav1dExtension.xcframework AgoraDav1dExtension framework
ios-x86_64-simulator ios-armv7_arm64' for the current build architectures (arm64 x86_64 i386).

Flutter Xcode build failed error unable to spawn process

I followed the Flutter docs to the letter doing the install etc. Downloaded the Zip and extracted to my own dev directory. I added the flutter path.
export PATH="/Users/me/dev/flutter/bin:$PATH"
Tested flutter doctor
$ flutter doctor -v
[✓] Flutter (Channel stable, 1.22.6, on macOS 11.2.1 20D75 darwin-x64, locale
en-US)
• Flutter version 1.22.6 at /Users/me/dev/flutter
• Framework revision 9b2d32b605 (5 weeks ago), 2021-01-22 14:36:39 -0800
• Engine revision 2f0af37152
• Dart version 2.10.5
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at /Users/me/Library/Android/sdk
• Platform android-30, build-tools 30.0.3
• Java binary at: /Applications/Android
Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build
1.8.0_242-release-1644-b3-6915495)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 12.4)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.4, Build version 12D4e
• CocoaPods version 1.10.1
[✓] Android Studio (version 4.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin installed
• Dart plugin version 201.9317
• Java version OpenJDK Runtime Environment (build
1.8.0_242-release-1644-b3-6915495)
[✓] IntelliJ IDEA Community Edition (version 2020.3.2)
• IntelliJ at /Applications/IntelliJ IDEA CE.app
• Flutter plugin installed
• Dart plugin version 203.6912
[✓] Connected device (1 available)
• iPhone 11 Pro (mobile) • 95B08A93-656C-42F9-AD8B-AF2325CFCAF2 • ios •
com.apple.CoreSimulator.SimRuntime.iOS-14-4 (simulator)
• No issues found!
/Users/me/dev/flutter/bin/flutter
/Users/me/dev/flutter/bin/dart
then did the Xcode set up according to the docs.
And finally created the flutter project from the command line, and flutter run.
Launching lib/main.dart on iPhone 11 Pro in debug mode...
Running Xcode build...
└─Compiling, linking and signing... 4.2s
Xcode build done. 48.4s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
error: unable to spawn process
'/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain
/usr/bin' (Permission denied) (in target 'Runner' from project 'Runner')
warning: Could not read serialized diagnostics file: error("Failed to open
diagnostics file") (in target 'Runner' from project 'Runner')
error: unable to spawn process
'/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain
/usr/bin' (Permission denied) (in target 'Runner' from project 'Runner')
warning: Could not read serialized diagnostics file: error("Failed to open
diagnostics file") (in target 'Runner' from project 'Runner')
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 11 Pro.
Any Ideas to the issue ?
Try to open ios folder by using Xcode and run it !

Flutter: firebase_admob build fails in Xcode

I have problem with archiving my project in Xcode, it fails and throws an error: Module 'firebase_admob' not found
Build project: $flutter build ios
Select Product > Archive
Also I had to rollback Google-Mobile-Ads-SDK version from the newest 8.0.0 to 7.69.0 to make $flutter build ios work as described here
I've already cleaned and updated pods:
$flutter clean
$rm ios/podfile.lock
$rm ios/podfile
$pod update
$flutter pub get
I set target version to 12.0 in Podfile and Xcode settings.
For now I can build my project with $flutter build ios command but I can't archive it in Xcode for further distribution.
Flutter doctor
[✓] Flutter (Channel stable, 1.22.6, on Mac OS X 10.15.7 19H2 darwin-x64, locale ru-RU)
• Flutter version 1.22.6 at /Users/bob/Documents/Projects/Flutter/flutter
• Framework revision 9b2d32b605 (3 weeks ago), 2021-01-22 14:36:39 -0800
• Engine revision 2f0af37152
• Dart version 2.10.5
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.1)
• Android SDK at /Users/bob/Library/Android/sdk
• Platform android-29, build-tools 29.0.1
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 12.3)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.3, Build version 12C33
• CocoaPods version 1.10.1
[✓] Android Studio (version 3.4)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin installed
• Dart plugin version 201.9245
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
[✓] VS Code (version 1.53.0)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.19.0
[!] Connected device
! No devices available
! Doctor found issues in 1 category.
Dart SDK 2.10.5
Flutter SDK 1.22.6
app 1.0.0+1
dependencies:
- cupertino_icons 1.0.0
- firebase_admob 0.11.0+1 [meta flutter firebase_core]
- firebase_core 0.7.0 [firebase_core_platform_interface flutter quiver meta firebase_core_web]
One way to get around this is to build ipa file. You have to change Flutter's channel to the beta or master and upgrade to the latest version:
$flutter channel beta
$flutter upgrade
Then you should use the new feature of build tool:
$flutter build ipa
It generates archive in your project folder: <app_name>/build/ios/archive/<provisioning_profile_name>.xcarchive
So, you can open generated archive (i.e. My Test App.xcarchive) with Xcode and then validate it and upload to AppStore Connect as usual.

Resources