2

its seems that my pod file is broken and I can't install app on my iPhone. I got error pod file "Running pod install Exited (sigterm) Exception: Error running pod install". I have already tried with remove old pod file, flutter clean, flutter get packages and build for iOS again and got the same error. You can find my pod file and pubspec.yaml below and there are no error in pubspec.yaml after a build. Any suggestion on how I can fix this error?

Pod file:

    # 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

Pubspec:

    environment:
      sdk: ">=2.7.0 <3.0.0"
    
    dependencies:
      flutter:
        sdk: flutter
      sqflite: any
      intl: ^0.16.1
      percent_indicator: "^1.0.13"
      scoped_model: ^1.0.1
      assets_audio_player: ^1.0.1
      screen: ^0.0.5
      flutter_launcher_icons: "^0.7.0"
      shared_preferences: ^0.5.3+1
      persistent_bottom_nav_bar: any
      custom_navigator: ^0.3.0
      flutter_svg: ^0.18.0
      http: ^0.12.1
      async: ^2.4.1
      stacked: ^1.6.0
      stacked_services: ^0.4.3
      provider: ^4.3.1
      get_it: ^4.0.2
      firebase_core: ^0.4.0+9
      firebase_analytics: ^5.0.2
      firebase_auth: ^0.16.1
      firebase_storage: ^3.1.6
      cloud_firestore: ^0.13.6
      google_maps_flutter: ^0.5.28+1
      map_view: "^0.0.14"
      google_maps_webservice: ^0.0.6
      geolocator: ^5.3.1
      flutter_polyline_points: ^0.2.1
      image_picker: ^0.6.7+2
      cached_network_image: ^2.2.0+1
    
    flutter_icons:
      android: "launcher_icon" 
      ios: true
      image_path: "assets/icons/tomato.png"
      # The following adds the Cupertino Icons font to your application.
      # Use with the CupertinoIcons class for iOS style icons.
      cupertino_icons: ^0.1.2
    
    dev_dependencies:
      flutter_test:
        sdk: flutter
    
    # For information on the generic Dart part of this file, see the
    # following page: https://dart.dev/tools/pub/pubspec
    
    # The following section is specific to Flutter.
    flutter:
    
      # The following line ensures that the Material Icons font is
      # included with your application, so that you can use the icons in
      # the material Icons class.
      uses-material-design: true
    
      # To add assets to your application, add an assets section, like this:
      assets:
          - assets/images/
          - assets/icons/
      #   - images/a_dot_ham.jpeg
    
      # An image asset can refer to one or more resolution-specific "variants", see
      # https://flutter.dev/assets-and-images/#resolution-aware.
    
      # For details regarding adding assets from package dependencies, see
      # https://flutter.dev/assets-and-images/#from-packages
    
      # To add custom fonts to your application, add a fonts section here,
      # in this "flutter" section. Each entry in this list should have a
      # "family" key with the font family name, and a "fonts" key with a
      # list giving the asset and other descriptors for the font. For
      # example:
    fonts:
        - family: Oxygen
          fonts:
            - asset: fonts/Oxygen-Regular.ttf
            - asset: fonts/Oxygen-Bold.ttf
              weight: 700
            - asset: fonts/Oxygen-Light.ttf
              weight: 300
              
      # For details regarding fonts from package dependencies,
      # see https://flutter.dev/custom-fonts/#from-packages
1

4 Answers 4

5

Solved it with:

flutter upgrade 
flutter clean
flutter pub get
rm -Rf ios/Pods
rm -Rf ios/.symlinks
pod cache clean --all
rm -Rf ios/Flutter/Flutter.framework
flutter build ios
Sign up to request clarification or add additional context in comments.

1 Comment

3. command should be: flutter pub get
1

In my case, neither of the solutions were working, and I was at a loss. However, after trying everything, I finally found a solution that worked for me.

To resolve the issue, follow these steps:

  1. Locate the podhelper.rb file in your Flutter SDK installation. The file should be located at path/to/flutter-sdk/packages/flutter_tools/bin/podhelper.rb.
  2. Open the podhelper.rb file in a text editor.
  3. Look for the line return [] unless File.exists? file_path.
  4. Replace File.exists? with File.exist?, so the line becomes return [] unless File.exist? file_path.
  5. Save the changes to the podhelper.rb file.

1 Comment

I have modified path/to/flutter-sdk/packages/flutter_tools/bin/podhelper.rb. When I execute the flutter clean command and recompile, .ios/Flutter/podhelper.rb will be regenerated and cannot be modified.
0

also can help

rm -Rf ios/Podgfile.lock
pod install --repo-update

2 Comments

This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. - From Review
@SahilKapoor: Why do you say that? This looks like an attempt to answer to me. It’d benefit from further explanation, but that’s a reason to encourage the author to edit their answer, not to vote to delete it.
0

This may not fix the issue, finally i find we also need change the template file in path/to/flutter-sdk/packages/flutter_tools/templates/module/ios/library/Flutter.tmpl/podhelper.rb.tmpl, Then replace File.exists? with File.exist?

1 Comment

As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.