Flutter : Could not build the precompiled application for the device. Error launching application on iPhone
Solution 1
If you want to simulate it immediately rather than taking care of the IDE issue generally, go to Tools -> Flutter -> Open iOS module in Xcode. But for a further solution, do a Flutter Clean, and remove the simulator from Xcode -> Window -> Devices and Simulators -> Simulators -> right click on your iOS simulator and click delete. Then add a new simulator from the bottom left corner “+” button in the same Devices and Simulators page you are on. Re run your app in flutter and it should be working.
Solution 2
Yes, I also got into this after upgrading to ios 14. So, first, add this to you podfile:
platform :ios, '9.0'
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
# drop deployment target so it works with ios14
config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET
end
end
end
and also run: flutter upgrade
For me, these 2 things fixed the problem.
Solution 3
What worked for me was a combination of 4 steps:
Step 1, modify Podfile
# Uncomment this line to define a global platform for your project
platform :ios, '12.1'
and add the following (iOS platform must match):
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.1'
end
end
end
Step 2, switch Flutter channel to master and upgrade Flutter
$ flutter channel master
$ flutter upgrade
Step 3, Upgrade dependencies
$ flutter pub upgrade
Step 4, clean and build
$ flutter clean
$ flutter build ios
Solution 4
A coworker told me to run:
flutter clean
then:
flutter pub get
after that it worked for me.
Solution 5
If you previously followed the FlutterFire steps here: https://firebase.flutter.dev/docs/overview#improve-ios-build-times then it is time to disable the pre-compiled version of Firestore stuff and let Xcode compile it from scratch.
In the file ios/Podfile
comment this line:
# pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :tag => '6.26.0'
Run your app and it should work now.
Punreach Rany
Updated on June 05, 2022Comments
-
Punreach Rany almost 2 years
I can't run my flutter project on an IOS device.
This is what I got after flutter run. I can't understand why. Please have a look at the error below and tell me how to fix this.
Launching lib/main.dart on iPhone in debug mode... Automatically signing iOS for device deployment using specified development team in Xcode project: L24VC6F98D Running Xcode build... Xcode build done. 8,2s Failed to build iOS app Error output from Xcode build: ↳ 2020-09-18 11:56:14.934 xcodebuild[29414:155421] warning: The file reference for "Objective-C/TOCropViewController/Models/TOActivityCroppedImageProvider.h" is a member of multiple groups ("TOCropViewController" and "TOCropViewController"); this indicates a malformed project. Only the membership in one of the groups will be preserved (but membership in targets will be unaffected). If you want a reference to the same file in more than one group, please add another reference to the same path. 2020-09-18 11:56:14.934 xcodebuild[29414:155421] warning: The file reference for "Objective-C/TOCropViewController/Views/TOCropOverlayView.h" is a member of multiple groups ("TOCropViewController" and "TOCropViewController"); this indicates a malformed project. Only the membership in one of the groups will be preserved (but membership in targets will be unaffected). If you want a reference to the same file in more than one group, please add another reference to the same path. 2020-09-18 11:56:14.934 xcodebuild[29414:155421] warning: The file reference for "Objective-C/TOCropViewController/Models/TOCroppedImageAttributes.h" is a member of multiple groups ("TOCropViewController" and "TOCropViewController"); this indicates a malformed project. Only the membership in one of the groups will be preserved (but membership in targets will be unaffected). If you want a reference to the same file in more than one group, please add another reference to the same path. 2020-09-18 11:56:14.934 xcodebuild[29414:155421] warning: The file reference for "Objective-C/TOCropViewController/Views/TOCropScrollView.h" is a member of multiple groups ("TOCropViewController" and "TOCropViewController"); this indicates a malformed project. Only the membership in one of the groups will be preserved (but membership in targets will be unaffected). If you want a reference to the same file in more than one group, please add another reference to the same path. 2020-09-18 11:56:14.934 xcodebuild[29414:155421] warning: The file reference for "Objective-C/TOCropViewController/Views/TOCropToolbar.h" is a member of multiple groups ("TOCropViewController" and "TOCropViewController"); this indicates a malformed project. Only the membership in one of the groups will be preserved (but membership in targets will be unaffected). If you want a reference to the same file in more than one group, please add another reference to the same path. 2020-09-18 11:56:14.934 xcodebuild[29414:155421] warning: The file reference for "Objective-C/TOCropViewController/Views/TOCropView.h" is a member of multiple groups ("TOCropViewController" and "TOCropViewController"); this indicates a malformed project. Only the membership in one of the groups will be preserved (but membership in targets will be unaffected). If you want a reference to the same file in more than one group, please add another reference to the same path. 2020-09-18 11:56:14.934 xcodebuild[29414:155421] warning: The file reference for "Objective-C/TOCropViewController/TOCropViewController.h" is a member of multiple groups ("TOCropViewController" and "TOCropViewController"); this indicates a malformed project. Only the membership in one of the groups will be preserved (but membership in targets will be unaffected). If you want a reference to the same file in more than one group, please add another reference to the same path. 2020-09-18 11:56:14.934 xcodebuild[29414:155421] warning: The file reference for "Objective-C/TOCropViewController/Models/TOCropViewControllerTransitioning.h" is a member of multiple groups ("TOCropViewController" and "TOCropViewController"); this indicates a malformed project. Only the membership in one of the groups will be preserved (but membership in targets will be unaffected). If you want a reference to the same file in more than one group, please add another reference to the same path. 2020-09-18 11:56:14.978 xcodebuild[29414:155477] DTDeviceKit: deviceType from d94358f0937915cc1dbf618d6c7be90be0612766 was NULL 2020-09-18 11:56:15.129 xcodebuild[29414:155486] DTDeviceKit: deviceType from d94358f0937915cc1dbf618d6c7be90be0612766 was NULL 2020-09-18 11:56:15.129 xcodebuild[29414:155486] DTDeviceKit: deviceType from d94358f0937915cc1dbf618d6c7be90be0612766 was NULL ** BUILD FAILED ** Xcode's output: ↳ Command CompileSwift failed with a nonzero exit code /Users/punreachrany/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/kakao _flutter_sdk-0.4.2/ios/Classes/SwiftKakaoFlutterSdkPlugin.swift:103:82: error: cannot convert value of type 'Error' to specified type 'ASWebAuthenticationSessionError.Code' if case ASWebAuthenticationSessionError.Code.canceledLogin = err { ^~~ /Users/punreachrany/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/kakao _flutter_sdk-0.4.2/ios/Classes/SwiftKakaoFlutterSdkPlugin.swift:108:72: error: cannot convert value of type 'Error' to specified type 'SFAuthenticationError.Code' if case SFAuthenticationError.Code.canceledLogin = err { ^~~ Command CompileSwift failed with a nonzero exit code Command CompileSwift failed with a nonzero exit code note: Using new build system note: Building targets in parallel note: Planning build note: Constructing build description 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 14.0.99. (in target 'shared_preferences' from project 'Pods') 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 14.0.99. (in target 'path_provider' from project 'Pods') 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 14.0.99. (in target 'onesignal_flutter' from project 'Pods') 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 14.0.99. (in target 'leveldb-library' from project 'Pods') 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 14.0.99. (in target 'image_picker' from project 'Pods') 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 14.0.99. (in target 'abseil' from project 'Pods') 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 14.0.99. (in target 'package_info' from project 'Pods') 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 14.0.99. (in target 'esys_flutter_share' from project 'Pods') 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 14.0.99. (in target 'PromisesObjC' from project 'Pods') 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 14.0.99. (in target 'TOCropViewController-TOCropViewControllerBundle' from project 'Pods') 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 14.0.99. (in target 'TOCropViewController' from project 'Pods') warning: Skipping duplicate build file in Copy Headers build phase: /Users/punreachrany/Desktop/Flutter/PhotoEarn/ios/Pods/TOCropViewController/Ob jective-C/TOCropViewController/Models/TOActivityCroppedImageProvider.h (in target 'TOCropViewController' from project 'Pods') warning: Skipping duplicate build file in Copy Headers build phase: /Users/punreachrany/Desktop/Flutter/PhotoEarn/ios/Pods/TOCropViewController/Ob jective-C/TOCropViewController/Views/TOCropOverlayView.h (in target 'TOCropViewController' from project 'Pods') warning: Skipping duplicate build file in Copy Headers build phase: /Users/punreachrany/Desktop/Flutter/PhotoEarn/ios/Pods/TOCropViewController/Ob jective-C/TOCropViewController/Models/TOCroppedImageAttributes.h (in target 'TOCropViewController' from project 'Pods') warning: Skipping duplicate build file in Copy Headers build phase: /Users/punreachrany/Desktop/Flutter/PhotoEarn/ios/Pods/TOCropViewController/Ob jective-C/TOCropViewController/Views/TOCropScrollView.h (in target 'TOCropViewController' from project 'Pods') warning: Skipping duplicate build file in Copy Headers build phase: /Users/punreachrany/Desktop/Flutter/PhotoEarn/ios/Pods/TOCropViewController/Ob jective-C/TOCropViewController/Views/TOCropToolbar.h (in target 'TOCropViewController' from project 'Pods') warning: Skipping duplicate build file in Copy Headers build phase: /Users/punreachrany/Desktop/Flutter/PhotoEarn/ios/Pods/TOCropViewController/Ob jective-C/TOCropViewController/Views/TOCropView.h (in target 'TOCropViewController' from project 'Pods') warning: Skipping duplicate build file in Copy Headers build phase: /Users/punreachrany/Desktop/Flutter/PhotoEarn/ios/Pods/TOCropViewController/Ob jective-C/TOCropViewController/TOCropViewController.h (in target 'TOCropViewController' from project 'Pods') warning: Skipping duplicate build file in Copy Headers build phase: /Users/punreachrany/Desktop/Flutter/PhotoEarn/ios/Pods/TOCropViewController/Ob jective-C/TOCropViewController/Models/TOCropViewControllerTransitioning.h (in target 'TOCropViewController' from project 'Pods') 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 14.0.99. (in target 'nanopb' from project 'Pods') 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 14.0.99. (in target 'gRPC-C++-gRPCCertificates-Cpp' from project 'Pods') 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 14.0.99. (in target 'GoogleDataTransport' from project 'Pods') 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 14.0.99. (in target 'GTMSessionFetcher' from project 'Pods') 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 14.0.99. (in target 'FBSDKCoreKit' from project 'Pods') 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 14.0.99. (in target 'BoringSSL-GRPC' from project 'Pods') 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 14.0.99. (in target 'BSImageView' from project 'Pods') 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 14.0.99. (in target 'BSGridCollectionViewLayout' from project 'Pods') 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 14.0.99. (in target 'GoogleUtilities' from project 'Pods') 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 14.0.99. (in target 'GoogleDataTransportCCTSupport' from project 'Pods') 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 14.0.99. (in target 'FBSDKLoginKit' from project 'Pods') 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 14.0.99. (in target 'image_cropper' from project 'Pods') 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 14.0.99. (in target 'GoogleAppMeasurement' from project 'Pods') 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 14.0.99. (in target 'gRPC-C++' from project 'Pods') 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 14.0.99. (in target 'OneSignal-iOS10.0' from project 'Pods') 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 14.0.99. (in target 'Flutter' from project 'Pods') 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 14.0.99. (in target 'gRPC-Core' from project 'Pods') 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 14.0.99. (in target 'FirebaseFirestore' from project 'Pods') 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 14.0.99. (in target 'FirebaseAuthInterop' from project 'Pods') 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 14.0.99. (in target 'firebase_auth' from project 'Pods') 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 14.0.99. (in target 'FirebaseCore' from project 'Pods') 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 14.0.99. (in target 'firebase_core' from project 'Pods') 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 14.0.99. (in target 'firebase_database' from project 'Pods') 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 14.0.99. (in target 'cloud_firestore' from project 'Pods') 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 14.0.99. (in target 'FirebaseAnalytics' from project 'Pods') 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 14.0.99. (in target 'FirebaseInstallations' from project 'Pods') 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 14.0.99. (in target 'FirebaseCoreDiagnosticsInterop' from project 'Pods') 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 14.0.99. (in target 'FirebaseAuth' from project 'Pods') 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 14.0.99. (in target 'FirebaseDatabase' from project 'Pods') 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 14.0.99. (in target 'OneSignal-iOS11.0' from project 'Pods') 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 14.0.99. (in target 'FirebaseStorage' from project 'Pods') 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 14.0.99. (in target 'FirebaseCoreDiagnostics' from project 'Pods') 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 14.0.99. (in target 'firebase_storage' from project 'Pods') 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 14.0.99. (in target 'Firebase' from project 'Pods') Could not build the precompiled application for the device. Error launching application on iPhone.
What can I do to fix this problem? Please give me a command line or sth. Please help me. I am looking forward to hearing from you. Thank you.
-
Punreach Rany over 3 yearsIt didn't work for me. Do you have any reference regarding this issue?
-
Didier Prophete over 3 yearsok, one more thing: edit your
ios/Runner.xcodeproj/project.pbxproj
and update theIPHONEOS_DEPLOYMENT_TARGET
to be9.0
(it should appear 3 times in this file). Replace them all. -
Didier Prophete over 3 yearsOh man... well, time to wait for ios 15 then :-) Sorry to hear that. Ok, what about completely updating your podfile with:
rm -rf ios/Podfile.lock; pod repo update
and then aflutter clean
? -
Didier Prophete over 3 yearsAny luck there? (I assume you also do a proper
flutter clean
before trying these fixes) -
Andrey over 3 yearsYou have a quote missing in your code snippet :) Plus for the latest flutter you need to add
config.build_settings.delete
to the existingpost_install do |installer|
section in that file as they don't support two post_install sections. Otherwise, it worked for me, thanks a lot. -
Michał Dobi Dobrzański almost 3 yearsUseless in this context and not relevant.
-
busuu over 2 yearswhat do you consider by "system"?
-
Gaurav Singh about 2 yearsYour laptop or computer.
-
nelsonspbr about 2 yearsThus worked for me - particularly restarting my Mac. Other answers might suggest to mark the "For install builds only" option - that actually broke things for me, it started complaining about not finding header files - e.g., Flutter.h. So yeah, at least in my case I didn't do that. By the way, the issue started to happen after some update in my Mac.
-
Kartik Garasia about 2 yearsIt did not work for me