Flutterfire: [Cloud Firestore] doesn't work with IOS (get stuck on pod install gRPC-Core)

Created on 11 May 2020  Â·  15Comments  Â·  Source: FirebaseExtended/flutterfire

Describe the bug
The issue is that the pod install process gets stuck on Installing gRPC-Core (1.28.0)
I have tried to isolate the problem and found out that cloud_firestore: ^0.13.5 is the problem

To Reproduce
Steps to reproduce the behavior:

  1. run flutter run
  2. got stuck on Running pod install...
  3. cd ios/
  4. run pod install got stuck on Installing gRPC-Core (1.28.0)

Expected behavior
To run the project with the firebase plugin

Additional context
This the pubscpec.yaml

name: homemanagement
description: A new Flutter application.

publish_to: 'none'

version: 1.0.0+1

environment:
  sdk: ">=2.7.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter

  firebase_analytics: ^5.0.2
  cloud_firestore: ^0.13.5
  firebase_storage: ^3.1.5
  firebase: ^7.3.0
  rxdart: ^0.24.0

  cupertino_icons: ^0.1.3

dev_dependencies:
  flutter_test:
    sdk: flutter

flutter:
  uses-material-design: true

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 parse_KV_file(file, separator='=')
  file_abs_path = File.expand_path(file)
  if !File.exists? file_abs_path
    return [];
  end
  generated_key_values = {}
  skip_line_start_symbols = ["#", "/"]
  File.foreach(file_abs_path) do |line|
    next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
    plugin = line.split(pattern=separator)
    if plugin.length == 2
      podname = plugin[0].strip()
      path = plugin[1].strip()
      podpath = File.expand_path("#{path}", file_abs_path)
      generated_key_values[podname] = podpath
    else
      puts "Invalid plugin specification: #{line}"
    end
  end
  generated_key_values
end

target 'Runner' do
  use_frameworks!
  use_modular_headers!

  # Flutter Pod

  copied_flutter_dir = File.join(__dir__, 'Flutter')
  copied_framework_path = File.join(copied_flutter_dir, 'Flutter.framework')
  copied_podspec_path = File.join(copied_flutter_dir, 'Flutter.podspec')
  unless File.exist?(copied_framework_path) && File.exist?(copied_podspec_path)
    # Copy Flutter.framework and Flutter.podspec to Flutter/ to have something to link against if the xcode backend script has not run yet.
    # That script will copy the correct debug/profile/release version of the framework based on the currently selected Xcode configuration.
    # CocoaPods will not embed the framework on pod install (before any build phases can generate) if the dylib does not exist.

    generated_xcode_build_settings_path = File.join(copied_flutter_dir, 'Generated.xcconfig')
    unless File.exist?(generated_xcode_build_settings_path)
      raise "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first"
    end
    generated_xcode_build_settings = parse_KV_file(generated_xcode_build_settings_path)
    cached_framework_dir = generated_xcode_build_settings['FLUTTER_FRAMEWORK_DIR'];

    unless File.exist?(copied_framework_path)
      FileUtils.cp_r(File.join(cached_framework_dir, 'Flutter.framework'), copied_flutter_dir)
    end
    unless File.exist?(copied_podspec_path)
      FileUtils.cp(File.join(cached_framework_dir, 'Flutter.podspec'), copied_flutter_dir)
    end
  end

  # Keep pod path relative so it can be checked into Podfile.lock.
  pod 'Flutter', :path => 'Flutter'

  # Plugin Pods

  # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
  # referring to absolute paths on developers' machines.
  system('rm -rf .symlinks')
  system('mkdir -p .symlinks/plugins')
  plugin_pods = parse_KV_file('../.flutter-plugins')
  plugin_pods.each do |name, path|
    symlink = File.join('.symlinks', 'plugins', name)
    File.symlink(path, symlink)
    pod name, :path => File.join(symlink, 'ios')
  end
end

# Prevent Cocoapods from embedding a second Flutter framework and causing an error with the new Xcode build system.
install! 'cocoapods', :disable_input_output_paths => true

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['ENABLE_BITCODE'] = 'NO'
    end
  end
end

Flutter doctor
Run flutter doctor and paste the output below:

[✓] Flutter (Channel stable, v1.17.0, on Mac OS X 10.15.4 19E266, locale en-IL)
    • Flutter version 1.17.0 at /Users/yuri.abramov/Flutter/flutter
    • Framework revision e6b34c2b5c (9 days ago), 2020-05-02 11:39:18 -0700
    • Engine revision 540786dd51
    • Dart version 2.8.1

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    • Android SDK at /Users/yuri.abramov/Library/Android/sdk
    • Platform android-29, build-tools 29.0.3
    • Java binary at: /Users/yuri.abramov/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/192.6392135/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.4.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.4.1, Build version 11E503a
    • CocoaPods version 1.9.1

[✓] Android Studio (version 3.6)
    • Android Studio at /Users/yuri.abramov/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/192.6392135/Android Studio.app/Contents
    • Flutter plugin version 45.1.1
    • Dart plugin version 192.7761
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)

[✓] IntelliJ IDEA Ultimate Edition (version 2020.1.1)
    • IntelliJ at /Users/yuri.abramov/Applications/JetBrains Toolbox/IntelliJ IDEA Ultimate.app
    • Flutter plugin version 44.0.3
    • Dart plugin version 193.6911.31

[✓] Connected device (1 available)
    • iPhone 11 Pro Max • 192CA87B-1416-449E-9569-91BC1FB0325F • ios • com.apple.CoreSimulator.SimRuntime.iOS-13-4 (simulator)

• No issues found!
Process finished with exit code 0

Already tried:
flutter pub cache repair and pod install
pod update Firebase/Firestore

crowd ios cloud_firestore bug

Most helpful comment

I had a similar issue where pod install would fail on gRPC-C++ because it couldn't include openssl. Adding the below to the Podfile to manually lock the version of BoringSSL_GRPC seemed to fix things up for me for the time being. Having other issues building right now, so if it turns out everything crashes and burns when running in-app, I'll amend this.

# lock the version of `BoringSSL-GRPC` so installing gRPC-C++ via cloud_firestore doesn't fail
pod 'BoringSSL-GRPC', '0.0.3'

This issue led me in the right direction: https://github.com/grpc/grpc/issues/16821

All 15 comments

Hi @yuriGett
Not able to reproduce this issue on pod version 1.9.1
Can you please try same packages in a new project?
Thank you

Hi @TahaTesser just tried on a new project and facing the same issue..

same here, any solution?

any solutions?

After couple hours of pod installation, it finally worked. I guess we have to be very very patient...

My solution was to download the Pod gRPC-Core from another project on Github and manually to add it to my Pods directory and then to run pod upgrade and pod install in ios directory

the cloning of the repositories when installing gRCP-Core seems to be endless but when running the Pod install verbose it is actually getting somewhere. This really is dependency hell.

Cloning into '/private/var/folders/0g/_zjqscqx6cl5ggymnnstyhkh0000gn/T/d20200524-50567-g2gos8/third_party/abseil-cpp'... Cloning into '/private/var/folders/0g/_zjqscqx6cl5ggymnnstyhkh0000gn/T/d20200524-50567-g2gos8/third_party/benchmark'... Cloning into '/private/var/folders/0g/_zjqscqx6cl5ggymnnstyhkh0000gn/T/d20200524-50567-g2gos8/third_party/bloaty'... Cloning into '/private/var/folders/0g/_zjqscqx6cl5ggymnnstyhkh0000gn/T/d20200524-50567-g2gos8/third_party/boringssl-with-bazel'... Cloning into '/private/var/folders/0g/_zjqscqx6cl5ggymnnstyhkh0000gn/T/d20200524-50567-g2gos8/third_party/cares/cares'... Cloning into '/private/var/folders/0g/_zjqscqx6cl5ggymnnstyhkh0000gn/T/d20200524-50567-g2gos8/third_party/envoy-api'... Cloning into '/private/var/folders/0g/_zjqscqx6cl5ggymnnstyhkh0000gn/T/d20200524-50567-g2gos8/third_party/gflags'... Cloning into '/private/var/folders/0g/_zjqscqx6cl5ggymnnstyhkh0000gn/T/d20200524-50567-g2gos8/third_party/googleapis'... Cloning into '/private/var/folders/0g/_zjqscqx6cl5ggymnnstyhkh0000gn/T/d20200524-50567-g2gos8/third_party/googletest'... Cloning into '/private/var/folders/0g/_zjqscqx6cl5ggymnnstyhkh0000gn/T/d20200524-50567-g2gos8/third_party/libuv'...

Okay got it to work by downgrading to an older version and now being able to build. But I am getting build times like 210.6s or 218.6s! This is seriously very bad.

Facing same issue. @KrystofM which version did you use.

I was having the same issue on a new project. But after getting stuck on gRPC-Core install I waited around 5-10 minutes and then it proceed with pod install. Probably it's a server issue.

I've waited and still am waiting it's been more than half an hour its still stuck on Run POD
Screenshot 2020-06-03 at 9 22 33 PM

IT WORKED LOL. BUT IT ONLY TOOK 69.7 MINUTES :D

Imagine 1hr and 9 minutes for a single POD install. They need to fix it!!

I had a similar issue where pod install would fail on gRPC-C++ because it couldn't include openssl. Adding the below to the Podfile to manually lock the version of BoringSSL_GRPC seemed to fix things up for me for the time being. Having other issues building right now, so if it turns out everything crashes and burns when running in-app, I'll amend this.

# lock the version of `BoringSSL-GRPC` so installing gRPC-C++ via cloud_firestore doesn't fail
pod 'BoringSSL-GRPC', '0.0.3'

This issue led me in the right direction: https://github.com/grpc/grpc/issues/16821

I had the same issue and this article helped.
Also be patient in the pod install as it could take like 15mins or more sometimes when you come across this issue.

https://medium.com/@phongyewtong/how-to-fix-flutter-stuck-at-running-pod-install-when-run-578ad867774

Hey all, as part of our on-going work for #2582, the project structure/setup for iOS & MacOS in our Firebase Firestore rework (#2913) has been improved which should help with this along with using the new pre-compiled Firestore binaries to improve build times.

The rework has now been merged into master. We'll look at publishing some prereleases in the next few days. Thank you

Was this page helpful?
0 / 5 - 0 ratings