Solved

PurchasesHybridCommon required a higher minimum deployment target

  • 24 January 2022
  • 11 replies
  • 3887 views

Userlevel 1
Badge +6

I have updated the dependencies of purchases_ flutter from 3.4.5 to 3.9.2.
But I have an error when I install the pod file.
Error is:
PurchasesHybridCommon required a higher minimum deployment target

The error occurs when I try to install the pod files and then install to an iOS device.

Can you help me?

icon

Best answer by Carlo Sacchetti 25 January 2022, 12:37

View original

11 replies

Userlevel 1
Badge +6

more information:

doctor -v

[✓] Flutter (Channel stable, 2.8.1, on macOS 11.6 20G165 darwin-x64, locale it-IT)
    • Flutter version 2.8.1 at /Users/carlosacchetti/Developer/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 77d935af4d (6 weeks ago), 2021-12-16 08:37:33 -0800
    • Engine revision 890a5fca2e
    • Dart version 2.15.1

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /Users/carlosacchetti/Library/Android/sdk
    • Platform android-31, build-tools 30.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)
    • 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 2020.3)
    • 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.10+0-b96-7281165)

[✓] IntelliJ IDEA Community Edition (version 2021.1.1)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • 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

[✓] VS Code (version 1.63.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.32.0

[✓] Connected device (1 available)
    • Chrome (web) • chrome • web-javascript • Google Chrome 97.0.4692.99

• No issues found!

 

 

My podfile

 

# Uncomment this line to define a global platform for your project

platform :ios, '12.1'

 

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.

ENV['COCOAPODS_DISABLE_STATS'] = 'true'

 

project 'Runner', {

'Debug' => :debug,

'Profile' => :release,

'Release' => :release,

}

 

def flutter_root

generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)

unless File.exist?(generated_xcode_build_settings_path)

raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"

end

 

File.foreach(generated_xcode_build_settings_path) do |line|

matches = line.match(/FLUTTER_ROOT\=(.*)/)

return matches[1].strip if matches

end

raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"

end

 

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

 

flutter_ios_podfile_setup

 

target 'Runner' do

use_frameworks!

use_modular_headers!

 

flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))

end

 

post_install do |installer|

installer.pods_project.targets.each do |target|

flutter_additional_ios_build_settings(target)

end

end

 

target 'ImageNotification' do

use_frameworks!

pod 'Firebase/Messaging'

end

 

Userlevel 1
Badge +6

The message of error:

In Podfile: purchases_flutter (from `.symlinks/plugins/purchases_flutter/ios`) was resolved to 3.9.2, which depends on Purchases Hybrid Common (= 1.11.2) Specs satisfying the `Purchase HybridCommon (= 1.9.1), PurchasesHybridCommon (= 1.11.2)` dependency were found, but they required a higher minimum deployment target.

Badge +1

This worked as a temporary fix for me, but I am decidely amateur at Podfiles.

Remove your Podfile.lock:

rm ios/Podfile.lock

Edit your Podfile ‘Runner’ section to include the updated PurchasesHybridCommon pod:

target 'Runner' do
use_frameworks!
use_modular_headers!

pod 'PurchasesHybridCommon', '1.11.2'

flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end

I had “use_frameworks!” commented out, not sure if you’ll need to do that.

Then in /ios directory, run:

pod repo update
pod install

Hope this helps!

Userlevel 5
Badge +10

Hi @Carlo Sacchetti 

The minimum deployment target for all our pods is 9.0 for iOS, and 10.12 for macOS, as defined in the following files:

You can still get this message if you haven't defined the deployment target in the Podfile itself, and you'd have to make sure that the deployment target is defined for both the iOS and the macOS target.

Have you already set the deployment target in the macOS target in the Podfile? If you have already set the deployment target and still seeing that error, there are a few things you can do:

  • Delete the Podfile.lock file and running pod install again
  • There’s a chance Flutter is overriding your macOS deployment target, probably in flutter_additional_macos_build_settings. If that’s the case, a workaround could be to add the following:

```

target.build_configurations.each do |config|
  config.build_settings['MACOSX_DEPLOYMENT_TARGET'] = '11.0'
end

```

right after the flutter_additional_macos_build_settings line in your Podfile.

Userlevel 1
Badge +6

I don't have the macOS Target in the podfile because my app is not made for macOS but only for iOS. It only works for phones and tablets and I would like to not add the macOS Target. It seems strange to me that for the plugin to work you need to add the macOS target as well.

Userlevel 5
Badge +10

Hey @Carlo Sacchetti 

You can ignore the sections about the macOS target if you are not supporting macOS. In case there’s anything wrong with the generated .lock file, have you tried deleting the Podfile.lock file and reinstalling the podfile yet? You should also try going a pod cache clean and update the PurchasesHybridCommon package. 

Userlevel 1
Badge +6

But is the purchases-hybrid-common package to be installed separately or is it automatically installed when I install purchases_flutter. Because until now I had installed nothing but purchases_flutter and everything worked fine.

Userlevel 1
Badge +6

How I can pod cache clean? What’s the command?

Userlevel 5
Badge +10

Hi @Carlo Sacchetti 

purchases-hybrid-common is a dependency for the Flutter SDK. I realized that the SDK team actually documented this issue here: https://docs.revenuecat.com/docs/troubleshooting-the-sdks#common-issues Can you follow the troubleshooting steps in the guide I linked and let me know if that helps? The command for Flutter would be pub cache clean

Userlevel 1
Badge +6

I resolve.

 

I delete Podfile.lock

rm -rf Podfile.lock

Remember that before you need to switch to iOS folder with command

cd ios

Or manually Delete Podfile.lock.

 

I clean the cache with

flutter clean

I get the dependeces again with 

flutter pub get

I reinstall the pod and update them with 

pod install --repo-update

 

Userlevel 1
Badge +6

Thank you all for your suggestions that led me to the solution.

Reply