Error when performing pod install command

  Kiến thức lập trình

I installed Flutter with following the documentation at their website but when I want to run it and perform pod install I get this error. I tried changing version of Cocoapods but it doesn’t work. Does anyone have an idea?

Analyzing dependencies
firebase_analytics: Using Firebase SDK version ‘10.20.0’ defined in ‘firebase_core’
firebase_core: Using Firebase SDK version ‘10.20.0’ defined in ‘firebase_core’
internal:/Users/name/.rbenv/versions/3.1.0/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb:85:in require': cannot load such file -- xcodeproj (LoadError) from <internal:/Users/name/.rbenv/versions/3.1.0/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in require’
from /Users/name/.pub-cache/hosted/pub.dev/firebase_crashlytics-3.4.13/ios/crashlytics_add_upload_symbols:1:in `’
firebase_crashlytics: Using Firebase SDK version ‘10.20.0’ defined in ‘firebase_core’
firebase_dynamic_links: Using Firebase SDK version ‘10.20.0’ defined in ‘firebase_core’
firebase_performance: Using Firebase SDK version ‘10.20.0’ defined in ‘firebase_core’
Downloading dependencies
Installing Firebase (10.20.0)
Installing FirebaseABTesting (10.27.0)
Installing FirebaseAnalytics (10.20.0)
Installing FirebaseCore (10.20.0)
Installing FirebaseCoreExtension (10.27.0)
Installing FirebaseCoreInternal (10.27.0)
Installing FirebaseCrashlytics (10.20.0)
Installing FirebaseDynamicLinks (10.20.0)
Installing FirebaseInstallations (10.27.0)
Installing FirebasePerformance (10.20.0)
Installing FirebaseRemoteConfig (10.27.0)
Installing FirebaseRemoteConfigInterop (10.27.0)
Installing FirebaseSessions (10.27.0)
Installing FirebaseSharedSwift (10.27.0)
Installing Flutter (1.0.0)
Installing GTMSessionFetcher (2.3.0)
Installing GoogleAppMeasurement (10.20.0)
Installing GoogleDataTransport (9.4.1)
Installing GoogleMLKit (4.0.0)
Installing GoogleToolboxForMac (2.3.2)
Installing GoogleUtilities (7.13.3)
Installing GoogleUtilitiesComponents (1.1.0)
Installing MLImage (1.0.0-beta4)
Installing MLKitBarcodeScanning (3.0.0)
Installing MLKitCommon (9.0.0)
Installing MLKitTextRecognition (2.0.0)
Installing MLKitTextRecognitionCommon (1.0.0)
Installing MLKitVision (5.0.0)
Installing PromisesObjC (2.4.0)
Installing PromisesSwift (2.4.0)
Installing ReachabilitySwift (5.2.3)
Installing ScreenProtectorKit (1.3.1)
Installing camera_avfoundation (0.0.1)
Installing connectivity_plus (0.0.1)
Installing device_info_plus (0.0.1)
Installing firebase_analytics (10.8.4)
Installing firebase_core (2.25.3)
Installing firebase_crashlytics (3.4.13)
Installing firebase_dynamic_links (5.4.12)
Installing firebase_performance (0.9.3-12)
Installing flutter_native_splash (0.0.1)
Installing flutter_nfc_kit (2.0.0)
Installing flutter_secure_storage (6.0.0)
Installing google_mlkit_barcode_scanning (0.9.0)
Installing google_mlkit_commons (0.5.0)
Installing google_mlkit_text_recognition (0.10.0)
Installing libPhoneNumber-iOS (0.9.15)
Installing libphonenumber (0.0.1)
Installing nanopb (2.30909.1)
Installing package_info_plus (0.4.5)
Installing path_provider_foundation (0.0.1)
Installing permission_handler_apple (9.1.1)
Installing rive_common (0.0.1)
Installing screen_brightness_ios (0.1.0)
Installing screen_protector (1.2.1)
Installing share_plus (0.0.1)
Installing shared_preferences_foundation (0.0.1)
Installing smart_auth (0.0.1)
Installing sqflite (0.0.3)
Installing url_launcher_ios (0.0.1)
Generating Pods project
Integrating client project

――― MARKDOWN TEMPLATE ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

Command

/usr/local/bin/pod install

Report

  • What did you do?

  • What did you expect to happen?

  • What happened instead?

Stack

   CocoaPods : 1.13.0
        Ruby : ruby 2.6.10p210 (2022-04-12 revision 67958) [universal.arm64e-darwin23]
    RubyGems : 3.0.3.1
        Host : macOS 14.5 (23F79)
       Xcode : 15.4 (15F31d)
         Git : git version 2.39.3 (Apple Git-146)
Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib
Repositories : trunk - CDN - https://cdn.cocoapods.org/

Plugins

cocoapods-deintegrate : 1.0.5
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.1
cocoapods-trunk       : 1.6.0
cocoapods-try         : 1.2.0

Podfile

# Uncomment this line to define a global platform for your project
platform :ios, '13.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__))
  target 'RunnerTests' do
    inherit! :search_paths
  end
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['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'
      config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
        '$(inherited)',

        ## dart: PermissionGroup.camera
        'PERMISSION_CAMERA=1',
      ]
    end
  end
end

Error

REXML::ParseException - #<TypeError: wrong argument type String (expected Regexp)>
/Library/Ruby/Gems/2.6.0/gems/rexml-3.2.9/lib/rexml/source.rb:220:in `scan'
/Library/Ruby/Gems/2.6.0/gems/rexml-3.2.9/lib/rexml/source.rb:220:in `match'
/Library/Ruby/Gems/2.6.0/gems/rexml-3.2.9/lib/rexml/parsers/baseparser.rb:227:in `pull_event'
/Library/Ruby/Gems/2.6.0/gems/rexml-3.2.9/lib/rexml/parsers/baseparser.rb:207:in `pull'
/Library/Ruby/Gems/2.6.0/gems/rexml-3.2.9/lib/rexml/parsers/treeparser.rb:23:in `parse'
/Library/Ruby/Gems/2.6.0/gems/rexml-3.2.9/lib/rexml/document.rb:448:in `build'
/Library/Ruby/Gems/2.6.0/gems/rexml-3.2.9/lib/rexml/document.rb:101:in `initialize'
/Library/Ruby/Gems/2.6.0/gems/xcodeproj-1.24.0/lib/xcodeproj/workspace.rb:83:in `new'
/Library/Ruby/Gems/2.6.0/gems/xcodeproj-1.24.0/lib/xcodeproj/workspace.rb:83:in `from_s'
/Library/Ruby/Gems/2.6.0/gems/xcodeproj-1.24.0/lib/xcodeproj/workspace.rb:66:in `new_from_xcworkspace'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.13.0/lib/cocoapods/installer/user_project_integrator.rb:102:in `create_workspace'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.13.0/lib/cocoapods/installer/user_project_integrator.rb:71:in `integrate!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.13.0/lib/cocoapods/installer.rb:929:in `block in integrate_user_project'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.13.0/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.13.0/lib/cocoapods/installer.rb:925:in `integrate_user_project'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.13.0/lib/cocoapods/installer.rb:185:in `integrate'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.13.0/lib/cocoapods/installer.rb:170:in `install!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.13.0/lib/cocoapods/command/install.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/claide-1.1.0/lib/claide/command.rb:334:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.13.0/lib/cocoapods/command.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.13.0/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:23:in `load'
/usr/local/bin/pod:23:in `<main>'
...
wrong argument type String (expected Regexp)
Line: 1
Position: 38
Last 80 unconsumed characters:
<?xml version="1.0" encoding="UTF-8"?>
/Library/Ruby/Gems/2.6.0/gems/rexml-3.2.9/lib/rexml/parsers/treeparser.rb:96:in `rescue in parse'
/Library/Ruby/Gems/2.6.0/gems/rexml-3.2.9/lib/rexml/parsers/treeparser.rb:21:in `parse'
/Library/Ruby/Gems/2.6.0/gems/rexml-3.2.9/lib/rexml/document.rb:448:in `build'
/Library/Ruby/Gems/2.6.0/gems/rexml-3.2.9/lib/rexml/document.rb:101:in `initialize'
/Library/Ruby/Gems/2.6.0/gems/xcodeproj-1.24.0/lib/xcodeproj/workspace.rb:83:in `new'
/Library/Ruby/Gems/2.6.0/gems/xcodeproj-1.24.0/lib/xcodeproj/workspace.rb:83:in `from_s'
/Library/Ruby/Gems/2.6.0/gems/xcodeproj-1.24.0/lib/xcodeproj/workspace.rb:66:in `new_from_xcworkspace'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.13.0/lib/cocoapods/installer/user_project_integrator.rb:102:in `create_workspace'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.13.0/lib/cocoapods/installer/user_project_integrator.rb:71:in `integrate!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.13.0/lib/cocoapods/installer.rb:929:in `block in integrate_user_project'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.13.0/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.13.0/lib/cocoapods/installer.rb:925:in `integrate_user_project'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.13.0/lib/cocoapods/installer.rb:185:in `integrate'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.13.0/lib/cocoapods/installer.rb:170:in `install!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.13.0/lib/cocoapods/command/install.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/claide-1.1.0/lib/claide/command.rb:334:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.13.0/lib/cocoapods/command.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.13.0/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:23:in `load'
/usr/local/bin/pod:23:in `<main>'

――― TEMPLATE END ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

Looking for related issues on cocoapods/cocoapods…
Searching for inspections failed: undefined method `map’ for nil:NilClass

LEAVE A COMMENT