0

I can't use install_all_flutter_pods(flutter_application_path) inside target 'Runner' do.

Found the error

[!] There are multiple dependencies with different sources for Flutter in Podfile:

  • Flutter (from Flutter)
  • Flutter (from ../my_app/.ios/Flutter/engine)

How to resolve it?

source 'https://github.com/CocoaPods/Specs.git'
source 'https://github.com/goinstant/pods-specs-public'

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

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
  'Debug' => :debug,
  'Profile' => :release,
  'Release' => :release,
}

flutter_application_path = '../my_app'
load File.join(flutter_application_path, '.ios', 'Flutter', 'podhelper.rb')

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

target 'Runner' do
  use_frameworks!
  use_modular_headers!
  pod 'RxSwift', '6.2.0'
  pod 'RxCocoa', '6.2.0'
  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end

target 'Runner' do
  install_all_flutter_pods(flutter_application_path)
end

post_install do |installer|
  flutter_post_install(installer) if defined?(flutter_post_install)
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)

    target.build_configurations.each do |config|
          config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= []

    end
  end
end

How to setup install_all_flutter_pods(flutter_application_path) and flutter_install_all_ios_pods File.dirname(File.realpath(FILE)) within target 'Runner' do?

0 Answers0