Home > front end >  Flutter video_editor plugin makes IOs app fail to build
Flutter video_editor plugin makes IOs app fail to build

Time:06-07

I added the package video_editor: ^1.4.2 to my project but it has since caused my ios to fail to run. It always fails with the message:

Lexical or Preprocessor Issue (Xcode): 'mobileffmpeg/LogDelegate.h' file not found
/Users/baw/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_ffmpeg-0.4.2/ios/Classes/EmptyLogDelegate.h:19:9

Could not build the application for the simulator.
Error launching application on iPhone 13.
Exited (sigterm)

So i need help on solving this. Ive tried googling this, but haven't found a solution anywhere.

Flutter doctor output

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.10.5, on macOS 12.3.1 21E258 darwin-x64, locale en-GB)
[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
[✓] Xcode - develop for iOS and macOS (Xcode 13.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.2)
[✓] VS Code (version 1.67.2)
[✓] Connected device (3 available)
[✓] HTTP Host Availability

• No issues found!

I tried flutter clean and it doesn't solve the issue. And I cannot upgrade to the latest flutter version 3, due to some packages i'm using that aren't supported yet. Any help rendered will be appreciated.

CodePudding user response:

ensure that you add dependency_overrides

dependency_overrides:
  ffmpeg_kit_flutter_min_gpl: ^4.5.1-LTS

CodePudding user response:

I got the solution to the problem and it lied behind the installation instructions. A change has to be made to the ios/Podfile. Adding the code segment below, before target 'Runner do line, resolves the issue.

# "fork" of method flutter_install_plugin_pods (in fluttertools podhelpers.rb) to get lts version of ffmpeg
  def flutter_install_plugin_pods(application_path = nil, relative_symlink_dir, platform)
    # defined_in_file is set by CocoaPods and is a Pathname to the Podfile.
    application_path ||= File.dirname(defined_in_file.realpath) if self.respond_to?(:defined_in_file)
    raise 'Could not find application path' unless 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(relative_symlink_dir, 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(application_path, '..', '.flutter-plugins-dependencies')
    plugin_pods = flutter_parse_plugins_file(plugins_file, platform)
    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(relative_symlink_dir, 'plugins', plugin_name, platform)
        else
          pod plugin_name, :path => File.join(relative_symlink_dir, 'plugins', plugin_name, platform)
        end
      end
    end
  end

Thank you!

  • Related