Skip to content
This repository has been archived by the owner on Oct 14, 2021. It is now read-only.

CocoaPods looks for the wrong package of ffmpeg #268

Closed
thegrxp opened this issue Mar 5, 2021 · 6 comments
Closed

CocoaPods looks for the wrong package of ffmpeg #268

thegrxp opened this issue Mar 5, 2021 · 6 comments

Comments

@thegrxp
Copy link

thegrxp commented Mar 5, 2021

Description
I've upgraded flutter to the latest version and since then I can't build on iOS, it is ok on Android.
I want to use the package min-gpl-lts but I get the following error:

[!] CocoaPods could not find compatible versions for pod "flutter_ffmpeg/https":
      In Podfile:
        flutter_ffmpeg (from `.symlinks/plugins/flutter_ffmpeg/ios`) was resolved to 0.3.1, which depends on
          flutter_ffmpeg/https (= 0.3.1)

    Specs satisfying the `flutter_ffmpeg/https (= 0.3.1)` dependency were found, but they required a higher minimum deployment target.

Minimum deployment is set at 10 everywhere. I've tried flutter clean
And my podfile

# Uncomment this line to define a global platform for your project
platform :ios, '10.0'

# 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

def flutter_install_ios_plugin_pods(ios_application_path = nil)
  # defined_in_file is set by CocoaPods and is a Pathname to the Podfile.
  ios_application_path ||= File.dirname(defined_in_file.realpath) if self.respond_to?(:defined_in_file)
  raise 'Could not find iOS application path' unless ios_application_path

  # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
  # referring to absolute paths on developers' machines.

  symlink_dir = File.expand_path('.symlinks', ios_application_path)
  system('rm', '-rf', symlink_dir) # Avoid the complication of dependencies like FileUtils.

  symlink_plugins_dir = File.expand_path('plugins', symlink_dir)
  system('mkdir', '-p', symlink_plugins_dir)

  plugins_file = File.join(ios_application_path, '..', '.flutter-plugins-dependencies')
  plugin_pods = flutter_parse_plugins_file(plugins_file)
  plugin_pods.each do |plugin_hash|
    plugin_name = plugin_hash['name']
    plugin_path = plugin_hash['path']
    if (plugin_name && plugin_path)
      symlink = File.join(symlink_plugins_dir, plugin_name)
      File.symlink(plugin_path, symlink)

      if plugin_name == 'flutter_ffmpeg'
          pod 'flutter_ffmpeg/min-gpl-lts', :path => File.join('.symlinks', 'plugins', plugin_name, 'ios')
      else
          pod plugin_name, :path => File.join('.symlinks', 'plugins', plugin_name, 'ios')
      end
    end
  end
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!
  pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :tag => '7.3.0'

  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

Flutter doctor

[✓] Flutter (Channel stable, 2.0.0, on macOS 11.2.2 20D80 darwin-x64, locale en-GB)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.1)
[✓] Connected device (3 available)

• No issues found!

Any idea?

Thank you for your amazing work

@tanersener
Copy link
Owner

You're not using the flutter_install_ios_plugin_pods method in your Podfile. Because of that, flutter tries to load the default https package.

[!] CocoaPods could not find compatible versions for pod "flutter_ffmpeg/https":

@tanersener tanersener added the question Further information is requested label Mar 5, 2021
@thegrxp
Copy link
Author

thegrxp commented Mar 5, 2021

You're not using the flutter_install_ios_plugin_pods method in your Podfile. Because of that, flutter tries to load the default https package.

[!] CocoaPods could not find compatible versions for pod "flutter_ffmpeg/https":

It is in the 'Runner' do. Maybe it should be elsewhere? Thanks

target 'Runner' do
  use_frameworks!
  use_modular_headers!
  pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :tag => '7.3.0'

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

@tanersener
Copy link
Owner

I'm not sure. This must be investigated. You're using the new flutter version. Maybe that is the reason why you get this error.

@thegrxp
Copy link
Author

thegrxp commented Mar 5, 2021

I've forked the library https://pub.dev/packages/video_trimmer which use ffmpeg.
I've updated the dependencies and ran the example sample. I get the same error

@chenchat
Copy link

chenchat commented Mar 5, 2021

This is a real problem, and I had the same problem when I upgraded Flutter to 2.0.0

@tanersener tanersener self-assigned this Mar 5, 2021
@tanersener tanersener added incompatibility and removed needs-analysis question Further information is requested labels Mar 5, 2021
@tanersener
Copy link
Owner

This issue happens because our old workaround to install packages do not work on Flutter 2.x. I added the new instructions under 2.1.2 iOS (Flutter >= 2.x). Please apply them.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants