flutterfire icon indicating copy to clipboard operation
flutterfire copied to clipboard

🐛 [firebase_core/firebase_crashlytics] Firebase core/crashlytics doesn't work with GoogleMLKit/TextRecognition on iOS

Open Wojew opened this issue 6 years ago • 5 comments

Bug report

Describe the bug I am trying to do pod install with this Podfile:

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

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

workspace "Runner"

def project_2_pods
  pod 'GoogleMLKit/TextRecognition'
  pod 'TensorFlowLiteSwift'
end

target 'project_2' do
  project 'project_2/project_2'
  project_2
end

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__))
  
  # Plugin Pods
  project_2_pods
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
    target.build_configurations.each do |config|
      config.build_settings['ENABLE_BITCODE'] = 'YES'
    end
  end
end

I get the error:

Analyzing dependencies
firebase_core: Using Firebase SDK version '6.26.0' defined in 'firebase_core'
firebase_crashlytics: Using Firebase SDK version '6.26.0' defined in 'firebase_core'
[!] CocoaPods could not find compatible versions for pod "FirebaseCore":
  In Podfile:
    firebase_core (from `.symlinks/plugins/firebase_core/ios`) was resolved to 0.5.0, which depends on
      Firebase/CoreOnly (~> 6.26.0) was resolved to 6.26.0, which depends on
        FirebaseCore (= 6.7.2)

    firebase_crashlytics (from `.symlinks/plugins/firebase_crashlytics/ios`) was resolved to 0.2.0-dev.5, which depends on
      Firebase/Crashlytics (~> 6.26.0) was resolved to 6.26.0, which depends on
        FirebaseCrashlytics (~> 4.1.1) was resolved to 4.1.1, which depends on
          FirebaseCore (~> 6.6)

CocoaPods could not find compatible versions for pod "GoogleDataTransport":
  In Podfile:
    GoogleMLKit/TextRecognition was resolved to 0.60.0, which depends on
      GoogleMLKit/MLKitCore (= 0.60.0) was resolved to 0.60.0, which depends on
        MLKitCommon (~> 0.60.0) was resolved to 0.60.0, which depends on
          GoogleDataTransport (~> 3.2)

    firebase_crashlytics (from `.symlinks/plugins/firebase_crashlytics/ios`) was resolved to 0.2.0-dev.5, which depends on
      Firebase/Crashlytics (~> 6.26.0) was resolved to 6.26.0, which depends on
        FirebaseCrashlytics (~> 4.1.1) was resolved to 4.1.1, which depends on
          GoogleDataTransport (~> 6.1)

I also tried pod install --repo-update but with no results. The main problem is pod 'GoogleMLKit/TextRecognition' because without it, pod install works correctly. Also on Android it works correctly.

Additional context

pubspec.yaml

firebase_core: ^0.5.0-dev.2
firebase_crashlytics: "^0.2.0-dev.5"

Please help - I don't know what I'm doing wrong.

Wojew avatar Sep 14 '20 11:09 Wojew

@Wojew, When you say on Android it works correctly, means, you are trying to run same setup on an Android device / emulator which compiles properly, correct ? Also, what cocoa-pod version do you have ? Thanks

darshankawar avatar Sep 14 '20 12:09 darshankawar

@Wojew, When you say on Android it works correctly, means, you are trying to run same setup on an Android device / emulator which compiles properly, correct ? Also, what cocoa-pod version do you have ? Thanks

I'll reply for him, as I have same issue: build works fine with Android target, fails for iOS

Nathagamelle avatar Sep 14 '20 20:09 Nathagamelle

@Wojew, When you say on Android it works correctly, means, you are trying to run same setup on an Android device / emulator which compiles properly, correct ? Also, what cocoa-pod version do you have ? Thanks

Yes - the same configuration works on Android (compiles properly as you said), on iOS it breaks when installing pods. CocoaPod version: 1.9.3

Wojew avatar Sep 15 '20 05:09 Wojew

Found solution/workaround: You need to add to Podfile:

$FirebaseSDKVersion = '6.32.2'
pod 'GoogleMLKit/TextRecognition', '0.63.0'

In my case:

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

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
$FirebaseSDKVersion = '6.32.2'
workspace "Runner"

def project_2_pods
  pod 'GoogleMLKit/TextRecognition', '0.63.0'
  pod 'TensorFlowLiteSwift'
end

target 'project_2' do
  project 'project_2/project_2'
  project_2
end

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__))
  
  # Plugin Pods
  project_2_pods
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
    target.build_configurations.each do |config|
      config.build_settings['ENABLE_BITCODE'] = 'YES'
    end
  end
end

Wojew avatar Sep 17 '20 05:09 Wojew

@Wojew Good to know you found the solution. @Nathagamelle please see the solution above and check if it works for you too. I am going ahead and closing this. If you disagree, write in comments and I'll reopen. Thanks.

darshankawar avatar Sep 17 '20 09:09 darshankawar