flutter Ios build fails after upgrading firebase core - ios

I had a flutter app which was working fine with firebase core (version 0.4.0). I upgraded the firebase_core to version 0.5.0 and did all changes as per the migration. After that ios build is giving following error
Launching lib/main.dart on iPhone SE (2nd generation) in debug mode...
Running Xcode build...
Xcode build done. 95.9s
Failed to build iOS app
Error output from Xcode build:
↳
AssertMacros: amdErr = AMDeviceConnect(tmpDevice) == 0 , file:
/BuildRoot/Library/Caches/com.apple.xbs/Sources/MobileDevice/MobileDevice-1190.100.2.1/Source/AMDevicePowerAssertion.c, line: 224, value: -402653083
** BUILD FAILED **
Xcode's output:
↳
<module-includes>:1:1: error: umbrella header for module 'GoogleUtilities' does not include header 'GULLoggerCodes.h' [-Werror,-Wincomplete-umbrella]
#import "Headers/GoogleUtilities-umbrella.h"
^
1 error generated.
In file included from /Users/yogesh/projects/mobile-flutter/ios/Pods/FirebaseCoreDiagnostics/Firebase/CoreDiagnostics/FIRCDLibrary/FIRCoreDiagnostics.m:24:
/Users/yogesh/projects/mobile-flutter/ios/Pods/FirebaseCoreDiagnostics/GoogleUtilities/Logger/Private/GULLogger.h:22:9: fatal error: could not build module
'GoogleUtilities'
#import <GoogleUtilities/GULLoggerLevel.h>
~~~~~~~^
2 errors generated.
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
It is running fine in android and even building ios build from xcode also works fine. Its build and run from command line which fails (flutter run)
Following is my pubspec file containing firebase dependency
dependencies:
flutter:
sdk: flutter
firebase_core: ^0.5.0
firebase_auth: ^0.18.0+1
cloud_firestore: ^0.14.0+2
sqflite:
path:
progress_dialog: ^1.2.4
i am not able to understand is it because of library error or something from my side because it seems lib error but android and ios build from xcode works totally fine.

Run command
flutter clean
And then re-run the application works for me.

I have just had the same issue as in I was able to run the app from XCode Runner but not from within Android Studio with the same exact error message. I managed to fix the issue via these steps:
Adding firebase_analytics: ^6.0.0 to pubspec.yaml.
Then removing Podfile and Podfile.lock.
And finally running it again.
However I cannot tell you why exactly it resolved the issue so cannot really guarantee this will work out for you.

delete Podfile and Podfile.lock and run it, it will work

Related

flutter build ios --release fatal error: module 'add_2_calendar' not found

I want to make a release for my project who work perefctly in dev mode.
When I make only flutter ios build it works fine
but flutter build ios --release doesn't work
the error message
youssefdahar#MacBook-Pro-van-Youssef devs % flutter build ios --release
Building com.example.mental for device (ios-release)...
Automatically signing iOS for device deployment using specified development team in Xcode project: X6BX32XBYP
Running pod install... 1 022ms
Running Xcode build...
└─Compiling, linking and signing... 1 163ms
Xcode build done. 47,6s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
Writing result bundle at path:
/var/folders/n7/4j0kgb856bl9z75hy71rfmj80000gn/T/flutter_tools.TVo200/flutter_ios_build_temp_dirNtfcgE/temporary_xcresult_bundle
/Users/youssefdahar/devs/ios/Runner/GeneratedPluginRegistrant.m:12:9: fatal error: module 'add_2_calendar' not found
#import add_2_calendar;
~~~~~~~^~~~~~~~~~~~~~
1 error 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/n7/4j0kgb856bl9z75hy71rfmj80000gn/T/flutter_tools.TVo200/flutter_ios_build_temp_dirNtfcgE/temporary_xcresult_bundle
It appears that your application still contains the default signing identifier.
Try replacing 'com.example' with your signing id in Xcode:
open ios/Runner.xcworkspace
Encountered error while building for device.
I saw in the in the internet that i have to clean project and pod folder and file and reinstall, i tried many times but in vain
thanks in advance for your help
Finally I figured out that pod init and install doesn't work correctly because the file podfile generate by pod init is not the same as podfile generated by flutter run.
The solution is I deleted all pod file and folder and lock and ran flutter run once

Flutter ios : camera/CameraPlugin.h' file not found

Created Flutter application built on both an Android and iOS device. Application is working fine with android and when i build my ios build it ends up with error as shown below.
Error while executing ios build in android studio using mac device.
i try plenty of method to solve this.
**FOLLOWED SETS:**
Flutter clean
Flutter pub get
Pod install
Build.
Output
Launching lib/main.dart on iPad in debug mode...
Automatically signing iOS for device deployment using specified development team in Xcode project: 3MDPB894U7
Running pod install...
Running Xcode build...
Xcode build done. 52.7s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
/Users/apple/AndroidStudioProjects/console/ios/Runner/GeneratedPluginRegistrant.m:12:9: fatal error: module 'camera' not found
#import camera;
~~~~~~~^~~~~~
1 error generated.
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
Could not build the precompiled application for the device.
Error launching application on iPad.
Change the target version to above 10.0.
Change in the Project Runner (in Xcode), PodFile & Target Runner (in Xcode), then run Pod Install
Make sure you open the .xcworkspace file instead of the .xcodeproj. This helped me to solve the issue.

Module 'flutter_local_notifications' not found in Xcode

In my app I am using flutter local notifications to push the notifications locally and the version of the package is: flutter_local_notifications: ^1.4.4+4. It is working perfectly fine on android. But it is throwing an error on Xcode saying "Module flutter_local_notifications is not found". Not sure what is causing this issue any help is appreciated.
This is my error:
fatal error: module 'flutter_local_notifications' not found
#import flutter_local_notifications;
~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
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 Max.
Make your iOS version in pod file same as Xcode deployment info in Xcode refer to below images
Xcode deployment info
PodFile

How to fix Command PhaseScriptExecution failed with a nonzero exit code on flutter run in macOS?

I am working on a flutter app. I recently shifted to macOS and since then haven't been able to run the app. Other apps are running fine so I think the error is in within the code of this app. And maybe because of this same reason I am unable to make a build.
Here is the output of flutter doctor:
[✓] Flutter (Channel stable, 1.20.1, on Mac OS X 10.15.6 19G73, locale en-US)
• Flutter version 1.20.1 at /Users/bhawna/dev/flutter
• Framework revision 2ae34518b8 (4 days ago), 2020-08-05 19:53:19 -0700
• Engine revision c8e3b94853
• Dart version 2.9.0
[✗] 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.6)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.6, Build version 11E708
• 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).
[✓] VS Code (version 1.47.3)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.13.2
[✓] Connected device (1 available)
• iPhone 8 (mobile) • 3D03BDE4-F1A6-45AB-B095-01107CDDC2CD • ios • com.apple.CoreSimulator.SimRuntime.iOS-13-6 (simulator)
Output of flutter run:
Running "flutter pub get" in delivero... 1.6s
Launching lib/main.dart on iPhone 8 in debug mode...
Running pod install... 38.2s
Running Xcode build...
Xcode build done. 449.0s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
/Users/bhawna/dev/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inapp_purchase-2.2.0/ios/Classes/FlutterInappPurchasePlugin.
m:45:52: warning: assigning to 'id<IAPPromotionObserverDelegate>' from incompatible type 'FlutterInappPurchasePlugin *__strong'
[IAPPromotionObserver sharedObserver].delegate = self;
^ ~~~~
/Users/bhawna/dev/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inapp_purchase-2.2.0/ios/Classes/FlutterInappPurchasePlugin.
m:200:79: warning: implicit conversion loses integer precision: 'SKPaymentTransactionState' (aka 'enum
SKPaymentTransactionState') to 'int' [-Wshorten-64-to-32]
[NSNumber numberWithInt: item.transactionState], #"transactionStateIOS",
~ ^~~~~~~~~~~~~~~~~~~~~
/Users/bhawna/dev/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inapp_purchase-2.2.0/ios/Classes/FlutterInappPurchasePlugin.
m:586:71: warning: implicit conversion loses integer precision: 'SKPaymentTransactionState' (aka 'enum
SKPaymentTransactionState') to 'int' [-Wshorten-64-to-32]
[NSNumber numberWithInt: transaction.transactionState], #"transactionStateIOS",
~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
3 warnings generated.
/Users/bhawna/dev/flutter/.pub-cache/hosted/pub.dartlang.org/contacts_service-0.3.10/ios/Classes/ContactsServicePlugin.m:6:4:
warning: 'SwiftContactsServicePlugin' is only available on iOS 9.0 or newer [-Wunguarded-availability]
[SwiftContactsServicePlugin registerWithRegistrar:registrar];
^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from
/Users/bhawna/dev/flutter/.pub-cache/hosted/pub.dartlang.org/contacts_service-0.3.10/ios/Classes/ContactsServicePlugin.m:2:
/Users/bhawna/delivero/delivero/build/ios/Debug-iphonesimulator/contacts_service/contacts_service.framework/Headers/contacts_serv
ice-Swift.h:213:12: note: 'SwiftContactsServicePlugin' has been marked as being introduced in iOS 9.0 here, but the deployment
target is iOS 8.0.0
#interface SwiftContactsServicePlugin : NSObject <FlutterPlugin>
^
/Users/bhawna/dev/flutter/.pub-cache/hosted/pub.dartlang.org/contacts_service-0.3.10/ios/Classes/ContactsServicePlugin.m:6:4:
note: enclose 'SwiftContactsServicePlugin' in an #available check to silence this warning
[SwiftContactsServicePlugin registerWithRegistrar:registrar];
^~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
/Users/bhawna/dev/flutter/packages/flutter_tools/bin/xcode_backend.sh: line 13: pushd: /Users/hrvoje/Documents/Delivero
Files/contactsFeature: No such file or directory
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 8.
Any help would be great. Thanks for your time.
Simple Commands that made my archive successful after 2 days of struggle:
flutter clean
flutter pub get
flutter pub upgrade
cd iOS
pod install
pod update
And the issue is resolved.
You won't believe it, but in my case the problem was caused by a corrupted image that was used to generate the launcher icons. Something with the alpha channel was messed up. After I fixed it, the product could be archived successfully.
In the migration try replacing the podfile with this:
https://github.com/jmagman/flutter/blob/40b21e52153e1246120e90d1c757c0ec4c34ebb0/dev/integration_tests/flutter_driver_screenshot_test/ios/Podfile
Steps:
Remove PodFile.lock
Replace Podfile
flutter clean
flutter pub get
cd ios /
pod install
pod update
relaunch
Now apparently it is an error generated by the automatic processes of the 1.20 of the flutter SDK. In my case, I removed all the plugins from my project and started placing them one by one.
In my project the error appeared because I had the plugin flutter_dotenv 2.1.0 and the .env files corrupt the automatic flutter process.
For me this error occurred because of low disc space. as I cleaned some of files and it worked
Delete podfile.lock
Ios>pod install
flutter clean
flutter run
Sometimes happen when you have this import 'dart:html'; and run the app in IOS.
Delete Run Binary from Build Phases.
Delete Thin Binary from Build Phases.
Check your image assets!
I spent days on this, upgraded flutter, upgraded Xcode, re-installed Xcode command line tools, and did every conceivable combination of flutter clean, flutter pub upgrade, pod install etc. I even used flutter create to regenerate the ios folder.
I searched for responses related to 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 because that was part of the Xcode error output, but in the end it was none of that.
I had recently added a new .png asset to my project and that was the problem. I converted it to .jpeg and the problem disappeared.
I was getting the Command PhaseScriptExecution failed error without any other details after upgrading Flutter from version 1.22.4 to 3.0.5 (and all dependencies to null-safety versions). MacOS 12.5, XCode 13.4.1.
My solution:
Delete the ios folder.
Run flutter create . from root project folder.
Remove unnecessary platform support that you don't need, I mean deleting e.g. the windows and linux folders.
Run the app just to confirm that the build is working now.
With your version control discard changes that you didn't expect (those outside ios folder): reset assets icons, set back your original bundle id, bundle display name, etc.
In the Xcode set back any "capabilities" that your app had (e.g. Push Notifications) and files added to Runner (e.g. GoogleService-Info.plist required by Firebase).
Test your app, check logs, and you're done!
Because of some dependency I also had to update iOS version in the Podfile:
platform :ios, '11.0'
Changes observerd after recreating the project:
In the ios/Podfile:
The use_modular_headers! from the top of file was removed
These 2 lines were added inside target 'Runner' do section:
use_frameworks!
use_modular_headers!
The ios/Flutter/AppFrameworkInfo.plist file was added, which was completely missing before.
Changes inside Info.plist:
MARKETING_VERSION value was replaced with FLUTTER_BUILD_NAME and CURRENT_PROJECT_VERSION with FLUTTER_BUILD_NUMBER
The following entry was added:
<key>CADisableMinimumFrameDurationOnPhone</key><true/>
These files were modified: ios/Runner.xcodeproj/project.pbxproj and ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
I don't know which of these changes made it working again, but you can try selectively some of them before you recreate the ios project from scratch.
TL;DR Try updating Flutter flutter upgrade
I had this error a few times and always try the flutter clean, flutter pub get...etc but it doesn't work, also try restarting laptop, deleting recently added assets (as some other comments suggest) but none of it works.
Then I remember how I fixed it the last time by updating Flutter, and it has just worked for me again so definitely worth a try!
Step:
Remove PodFile.lock
Remove GeneratedPluginRegistrant.h
Remove GeneratedPluginRegistrant.m
Replace podfile
flutter clean
flutter pub get
cd ios /
pod install
pod update (Use this command when you get an error in pod install)
relaunch
In my case,I got the same error when I am trying to setup flutter and run app in macbook with Apple Chip.
Flutter app ran in chrome browser but didnt work in Android emulator. I found that I had to install to rosetta.
sudo softwareupdate --install-rosetta --agree-to-license
It was also mentioned in documentation here,but somehow I got to missed that thing while setup.
The only thing that worked for me was to backup my project and clone a fresh copy from the repository. I suspect it was an issue with one of the hidden files or folders like .symlinks or Pods.

Can't build for release - Flutter, Xcode

I have built a couple of Flutter apps using IntelliJ and xcode on a Mac server to build for ios release, and it has worked fine. Now I am suddenly having troubles building for release.
To test to see if it was something in my app, I just started a new app from scratch in IntelliJ on the server, configured the framework (including directing to the flutter install), and tested it out.
It builds and runs on the simulator just fine. But when I try to build for release ("flutter build ios" from command line) I get an error, which I will paste at the end of this message.
I have been trying for some time to figure out why I am getting the errors when building my app. Now even the default app seems broken.
Does the problem have something to do with the server?
Thank you.
The error message that I get when building for release (I gave the project a silly name, added an icon, and gave the app a build and version number, but otherwise it is an untouched flutter default app):
74-80-250-218:untitled userxxxxx$ flutter build ios
Building com.burrito.untitled for device (ios-release)...
Automatically signing iOS for device deployment using specified development team
in Xcode project: xxxxxxxxxx
Running Xcode build...
├─Building Dart code... 22.7s
├─Generating dSYM file... 0.2s
├─Stripping debug symbols... 0.0s
├─Assembling Flutter resources... 1.2s
└─Compiling, linking and signing... 0.2s
Xcode build done. 26.2s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
In file included from
/Users/userxxxxxx/Desktop/untitled/ios/Runner/GeneratedPluginRegistrant.m:5:
/Users/userxxxxxx/Desktop/untitled/ios/Runner/GeneratedPluginRegistrant.h:8:
9: fatal error: 'Flutter/Flutter.h' file not found
#import
^~~~~~~~~~~~~~~~~~~
1 error generated.
In file included from
/Users/userxxxxx/Desktop/untitled/ios/Runner/GeneratedPluginRegistrant.m:5:
/Users/userxxxxxx/Desktop/untitled/ios/Runner/GeneratedPluginRegistrant.h:8:
9: fatal error: 'Flutter/Flutter.h' file not found
#import
^~~~~~~~~~~~~~~~~~~
1 error generated.
Encountered error while building for device.
You could try deleting the ios folder on the project and generate an iOS build again by running flutter create --platforms=ios [PROJECT_PATH]. That should generate an iOS project from your Flutter code. After that, run flutter build ios again.

Resources