Search code examples
iosfluttercocoapodsconnectivityxcode13.2

flutter_offline library issue: Conflicts of library for Reachability in iOS


My flutter app was running well even with Xcode 13.2.1. After making some changes to the code, I tried to build it with iOS. It's building alright. But when I try to Archive the project for Testflight I am having the following error.

Multiple commands produce '/Users/mdhasanrahman/Library/Developer/Xcode/DerivedData/Runner-fgzktmibyndpbgfkmsizqhgncvxe/Build/Intermediates.noindex/ArchiveIntermediates/Runner/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/Reachability.framework':

  1. Target 'Reachability' has create directory command with output '/Users/mdhasanrahman/Library/Developer/Xcode/DerivedData/Runner-fgzktmibyndpbgfkmsizqhgncvxe/Build/Intermediates.noindex/ArchiveIntermediates/Runner/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/Reachability.framework'
  2. Target 'ReachabilitySwift' has create directory command with output '/Users/mdhasanrahman/Library/Developer/Xcode/DerivedData/Runner-fgzktmibyndpbgfkmsizqhgncvxe/Build/Intermediates.noindex/ArchiveIntermediates/Runner/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/Reachability.framework'

There is also a Target Integrity issue.

Multiple targets match implicit dependency for linker flags '-framework Reachability'. Consider adding an explicit dependency on the intended target to resolve this ambiguity. (in target 'Runner' from project 'Runner')

Target 'Reachability' (in project 'Pods')

Target 'ReachabilitySwift' (in project 'Pods')

I have tried all the solutions I could fing over the last 4 days. Still no luck. I am currently on Flutter (Channel master, 2.11.0-0.0.pre.450, on macOS 12.1) with M1 Max processor. Following is the Podfile

# Uncomment this line to define a global platform for your project
# platform :ios, '9.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

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


Solution

  • You have added more than one connectivity plugins in your pubspec.yaml file. Please remove all of the other plugins and put only one.