174

I changed everything to 9.0 in the project but I'm having the same error in a lot of pods.

I tried doing a lot of different things but nothing worked. Does anyone know how can I fix this?

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 '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 '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 '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 'vibration' 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 '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 '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 'gRPC-C++' from project 'Pods')

Encountered error while building for device.

matt
  • 515,959
  • 87
  • 875
  • 1,141
Raffaelli L.C.
  • 5,237
  • 5
  • 11
  • 18
  • 1
    Please note, however, that these are just warnings! They are not errors. Therefore, if your build crashes, it's because of something else, not the above. Run a search for the word "error" in your build output! :) – Karolina Hagegård Aug 20 '22 at 11:02

18 Answers18

220

What worked for me is a combination of @raffaelli-l-c and @arhan-reddy-busam answer.

Ensure that you do the following:

  • Set MinimumOSVersion to 9.0 in ios/Flutter/AppFrameworkInfo.plist
  • Ensure that you uncomment platform :ios, '9.0' in ios/Podfile
  • Ensure that ios/Podfile contains the following post install script:
    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'] = '9.0'
        end
      end
    end

The following routine works for me when doing my production build:

    flutter clean \
        && rm ios/Podfile.lock pubspec.lock \
        && rm -rf ios/Pods ios/Runner.xcworkspace \
        && flutter build ios --build-name=1.0.0 --build-number=1 --release --dart-define=MY_APP_ENV=prod
Je Suis Alrick
  • 3,404
  • 2
  • 16
  • 23
  • 9
    `flutter clean && rm ios/Podfile.lock pubspec.lock && rm -rf ios/Pods ios/Runner.xcworkspace` just executing this did the trick for me – buncis Jan 06 '21 at 16:17
  • 47
    I think this is really ridiculous that we have to edit the Podfile manually for almost a year now. But yes, this does solve the problem. – Cliff Helsel Jan 23 '21 at 18:13
  • 2
    Does not work for me, getting Generate dPluginRegistrant.h:8:9: error: 'Flutter/Flutter.h' file not found #import ^ 1 error generated. :0: error: failed to emit precompiled header – Harsh Phoujdar Apr 17 '21 at 16:10
  • This is finally what worked for me. I was getting an error that said `Error: Member not found: 'packageRoot'. ../…/interface/local_platform.dart:46` `io.Platform.packageRoot; // ignore: deprecated_member_use` – RadicalTurnip Apr 01 '22 at 19:38
  • Even if I put the `MinimumOSVersion` to "99.0" in `ios/Flutter/AppFrameworkInfo.plist`, it does nothing! My minimum target iOS is still too low!... Seems Flutter ignores this setting. – Karolina Hagegård Aug 20 '22 at 11:00
87

I solve it with this code, thanks! At the end of the PodFile

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
    end
  end
end
Raffaelli L.C.
  • 5,237
  • 5
  • 11
  • 18
  • 1
    Seems interesting, can you explain it's functioning? thanks – funder7 Mar 19 '21 at 00:56
  • Does not work for me, getting error while building ** BUILD FAILED ** Xcode's output: ↳ In file included from flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-1.6.27/ios/Classes/FLTPathProviderPlugin.m:5:flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-1.6.27/ios/Classes/FLTPathProviderPlugin.h:5:9:fatal error: 'Flutter/Flutter.h' file not found #import ^~~~~~~~~~~~~~~~~~~ 1 error generated. note: Using new build system note: Building targets in parallel note: Planning build note: Constructing build description – Harsh Phoujdar Apr 17 '21 at 16:06
  • @HarshPhoujdar I'm facing the same issue, did you solve it? – Davide Bicego Apr 22 '21 at 08:30
  • 1
    @DavideBicego I have been stuck for past week on this, I am hoping someone replies and helps us. I have gone through a myriad of stackoverflow answers and tried everything. Basically it seems to be stuck in a loop where one solution says to downgrade cocoapods, and flutter 2 says to keep the latest ones. – Harsh Phoujdar Apr 22 '21 at 10:51
  • 2
    @HarshPhoujdar I managed to solve the issue updating most of my dependences. In particular Firebase packages were the problematic ones. They were not compatible with flutter v2 probably. I went from firebase_core: ^0.7.0, firebase_crashlytics: ^0.4.0+1, firebase_messaging: ^8.0.0-dev.15 to firebase_core: ^1.0.4, firebase_crashlytics: ^2.0.1, firebase_messaging: ^9.1.2 – Davide Bicego Apr 22 '21 at 14:05
  • 2
    @bks It deletes the deployment target included for all the targets, so it's set to the default determined by Xcode. – ReinstateMonica3167040 May 26 '21 at 15:15
  • 1
    @ReinstateMonica3167040 Thank you! – bks May 26 '21 at 20:58
  • when i did so. and try to fun. it showed flutter.h not found ... – Sras Sep 03 '21 at 11:33
  • 1
    @Sras For flutter apps, `flutter_additional_ios_build_settings(target)` should be added after line `installer.pods_project.targets.each do |target|`. – goldensoju Jun 04 '22 at 23:43
  • @goldensoju i dont know somehow, it works when i try to reinstall the gem. – Sras Jun 06 '22 at 06:00
23

go to Pods and for each framework you're using change the iOS version as shown in my screenshot

enter image description here

hamdi islam
  • 1,327
  • 14
  • 26
  • 3
    This is not correct (at least, not completely) - the script in ios/Podfile is supposed to do this operation automatically, check @"Je suis alrick" answer please! – funder7 Mar 19 '21 at 00:58
17

This is because XCode 12 does only support building for the iOS target versions 9 - 14. Unfortunately the default iOS target set by flutter is 8. But you should be able to change the target in the ios/Runner.xcworkspace file using XCode. See flutter documentation section "Review Xcode project settings" -> headline "Deployment Target:".

You could also try updating flutter to 1.22 beta, which supports iOS 14 and XCode 12 (as noted here)

1024kilobyte
  • 413
  • 4
  • 10
  • 4
    I think Apple needs to work for developer it is so tricky – dontknowhy Feb 17 '21 at 15:12
  • 4
    I think Flutter should do a better job of updating the builds. ^ – Modesto Cabrera Feb 20 '21 at 14:06
  • 1
    @rounpaleum if you ever write native code you know that apple does it. I actually forced to do react-native right now and it's a hell compared to go all in native on both plattforms. Every upgrade is a pain in the a** – Tob Jun 13 '21 at 09:57
7

I tried a bunch of things but what seems to have fixed this for me was:

flutter pub cache repair

https://dart.dev/tools/pub/cmd/pub-cache

Cadoo
  • 807
  • 5
  • 13
3

After couple of days trying to figure out what to do.

The only thing that worked for me was deleting the entire ios directory in my Flutter project, then rebuilding it:

flutter create .

Add GoogleService-Info.plist to Runner. Add signing & capabilities in Xcode. Add target properties in Xcode such as sign-in.

As mentioned in: https://stackoverflow.com/a/67224108/7749979

TuGordoBello
  • 4,350
  • 9
  • 52
  • 78
Omer.rah
  • 71
  • 6
3

All these answers, and in fact, you can safely ignore those logs! They're just warnings, not errors!

If your build fails, it's because of something else, not this. Do a Command + F in the output logs of your build and search for the word "error". That will tell you what the real problem is.

(Then again, if you REALLY want to get rid of those warnings, you can do a Command + Shift + F in your Android Studio project, or just a global search of some sort if you're using a different IDE, and search for 'IPHONEOS_DEPLOYMENT_TARGET'. Then, everywhere you see that value set to '8.0' inside your pods, you can change it to '9.0' or '10.0' or whatever value you want that's within the specified range. This won't do anything to the function of your app, but you won't have to see the warnings again!)

Karolina Hagegård
  • 1,180
  • 5
  • 26
2

For me what worked is, open XCode in ios folder. Then check and fix possible account related problem in Signing section. Then run flutter run again. And it worked. Not sure why is it related to this error but it worked.

2

You need to update your pod file

iOS Project:

  1. Set platform OS & version, first line of Pod file, for me its...

platform :ios, '13.6'

  1. Add this additional code to your pod file:
post_install do |installer|
  installer.generated_projects.each do |project|
    project.targets.each do |target|
      target.build_configurations.each do |config|
        config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.6'
      end
    end
  end
end

macOS Project:

  1. Set platform OS & version, first line of Pod file, for me its...

platform :macos, '11.5'

  1. Add this additional code to your pod file:
post_install do |installer|
  installer.generated_projects.each do |project|
    project.targets.each do |target|
      target.build_configurations.each do |config|
        config.build_settings['MACOSX_DEPLOYMENT_TARGET'] = '11.5'
      end
    end
  end
end

Similar for tvOS & watchOS

tvOS - ['TVOS_DEPLOYMENT_TARGET'] = 'VERSION'

watchOS - ['WATCHOS_DEPLOYMENT_TARGET'] = 'VERSION'

That’s it, Cheers!

Ashvin
  • 8,227
  • 3
  • 36
  • 53
1

Make sure, in any of your dart files has not imported the dart.html package. This caused a problem in my case when flutter tries to install the pod.

dilip
  • 163
  • 8
1

I got so fed up, so I just compiled in Xcode 13. Works for me! Since upgrading to Flutter 2.5.2, I got this weird issue. Minor hassle.

ios/Podfile:

platform :ios, '10.0'

I change minimumOS to 10

ouflak
  • 2,458
  • 10
  • 44
  • 49
0

Just Follow Below Command Line in Your macOS

  1. flutter clean
  2. rm ios/Podfile.lock pubspec.lock
  3. rm ios/Podfile.lock pubspec.lock
  4. rm -rf ios/Pods ios/Runner.xcworkspace
0
  1. Open Xcode
  2. Change Project Document - Project format - Xcode 8.0-Compatible
  3. Flutter clean, flutter pub get and flutter build iOS
stateMachine
  • 5,227
  • 4
  • 13
  • 29
0

After trying most of these solutions the only thing that worked for me is to uncomment and add ios 10 in ios/Podfile:

platform :ios, '10.0'
Hassan Hammad
  • 172
  • 1
  • 9
0

In my case this error was misleading.

Turns out, the problem was caused by a missing step in Firebase upgrade docs: delete the Fabric build step in XCode.

Here's the article I found that actually solved the cause of this error for me: SO post towards the bottom it mentions the Fabric dependency.

I added the new Run Script in XCode per the firebase docs referenced, removed the Fabric related build phase, and the 8.0 target error went away.

I hope this helps anyone else who went down the PodFile dependency rabbit hole that I did.

Nathan Agersea
  • 496
  • 3
  • 17
0

Change MinimumOSVersion to 9.0 in /ios/Flutter/AppFrameworkInfo.plist.

Then in ios/Runner.xcodeproj/project.bpxproj replace IPHONEOS_DEPLOYMENT_TARGET = 8.0 to IPHONEOS_DEPLOYMENT_TARGET = 9.0 in three lines.

It also works if you are building your .ipa whit codemagic

Mátyás Grőger
  • 1,207
  • 2
  • 13
  • 24
Joel C
  • 1
  • 1
0

I recently upgraded nodejs with nvm and got this error (using React Native btw). I tried everything that does not require code changes. After switching back from nodejs 16 to 14, it worked again. But it wasn't the root cause. Try to read everything above the error. For me there was a line:

nvm is not compatible with the "npm_config_prefix" environment variable

After upgrading nvm from 0.33 to 0.39 it worked, even with nodejs 16

Rebs
  • 233
  • 3
  • 9
-2

When updating to iOs 14.4 it seems that the path_provider package is not compatible with target 10.0. Currently Firebase package requires target 10.0. Here's the problem, I've had the problem for a month now. Maybe the Flutter team can help. When building iOs, there is an error that cannot be fixed, hic hic.

Launching lib/main.dart on iPhone 12 Pro in debug mode... Running pod install... Running Xcode build... Xcode build done. 29.4s Failed to build iOS app Error output from Xcode build: ↳ ** BUILD FAILED **

Xcode's output: ↳ In file included from /Users/maitrongtue/.pub-cache/hosted/pub.dartlang.org/path_provider-2.0.1/ios/Classes/FLTPathProviderPlugin.m:5: /Users/maitrongtue/.pub-cache/hosted/pub.dartlang.org/path_provider-2.0.1/ios/Classes/FLTPathProviderPlugin.h:5:9: fatal error: 'Flutter/Flutter.h' file not found #import <Flutter/Flutter.h> ^~~~~~~~~~~~~~~~~~~ 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 12 Pro.