Search code examples
iosflutterxcodecocoacocoapods

Flutter project. After upgrade to XCode 15.0.1 `pod install` throw error ParserError of FlutterMacOS.podspec.json 3.13.2


I've upgrade XCode and MacOS and now my Flutter project (as always in the case of XCode) doesn't work. There is some issue with pods but I don't understand

Details

Command

/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/bin/pod install

Report

  • What did you do?

  • What did you expect to happen?

  • What happened instead?

Stack

   CocoaPods : 1.13.0
        Ruby : ruby 3.2.2 (2023-03-30 revision e51014f9c0) [arm64-darwin23]
    RubyGems : 3.4.10
        Host : macOS 14.0 (23A344)
       Xcode : 15.0.1 (15A507)
         Git : git version 2.39.3 (Apple Git-145)
Ruby lib dir : /opt/homebrew/Cellar/ruby/3.2.2_1/lib
Repositories : trunk - CDN - https://cdn.cocoapods.org/

Plugins

cocoapods-clean       : 0.0.1
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, '11.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)
  end
end

Error

JSON::ParserError - Failed to parse JSON at file: '/Users/koptehe/.cocoapods/repos/trunk/Specs/4/2/c/FlutterMacOS/3.13.2/FlutterMacOS.podspec.json'.

unexpected token at ''
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-core-1.13.0/lib/cocoapods-core/specification/json.rb:66:in `rescue in from_json'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-core-1.13.0/lib/cocoapods-core/specification/json.rb:61:in `from_json'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-core-1.13.0/lib/cocoapods-core/specification.rb:752:in `from_string'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-core-1.13.0/lib/cocoapods-core/specification.rb:726:in `from_file'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-core-1.13.0/lib/cocoapods-core/source.rb:188:in `specification'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-core-1.13.0/lib/cocoapods-core/specification/set.rb:58:in `block in specification_name'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-core-1.13.0/lib/cocoapods-core/specification/set.rb:56:in `each'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-core-1.13.0/lib/cocoapods-core/specification/set.rb:56:in `specification_name'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-core-1.13.0/lib/cocoapods-core/cdn_source.rb:216:in `search'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-core-1.13.0/lib/cocoapods-core/source/aggregate.rb:83:in `block in search'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-core-1.13.0/lib/cocoapods-core/source/aggregate.rb:83:in `select'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-core-1.13.0/lib/cocoapods-core/source/aggregate.rb:83:in `search'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-1.13.0/lib/cocoapods/resolver.rb:416:in `create_set_from_sources'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-1.13.0/lib/cocoapods/resolver.rb:385:in `find_cached_set'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-1.13.0/lib/cocoapods/resolver.rb:360:in `specifications_for_dependency'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-1.13.0/lib/cocoapods/resolver.rb:165:in `search_for'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-1.13.0/lib/cocoapods/resolver.rb:274:in `block in sort_dependencies'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-1.13.0/lib/cocoapods/resolver.rb:267:in `each'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-1.13.0/lib/cocoapods/resolver.rb:267:in `sort_by'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-1.13.0/lib/cocoapods/resolver.rb:267:in `sort_by!'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-1.13.0/lib/cocoapods/resolver.rb:267:in `sort_dependencies'
/Users/koptehe/.gem/ruby/2.7.2/gems/molinillo-0.8.0/lib/molinillo/delegates/specification_provider.rb:60:in `block in sort_dependencies'
/Users/koptehe/.gem/ruby/2.7.2/gems/molinillo-0.8.0/lib/molinillo/delegates/specification_provider.rb:77:in `with_no_such_dependency_error_handling'
/Users/koptehe/.gem/ruby/2.7.2/gems/molinillo-0.8.0/lib/molinillo/delegates/specification_provider.rb:59:in `sort_dependencies'
/Users/koptehe/.gem/ruby/2.7.2/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:754:in `push_state_for_requirements'
/Users/koptehe/.gem/ruby/2.7.2/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:744:in `require_nested_dependencies_for'
/Users/koptehe/.gem/ruby/2.7.2/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:727:in `activate_new_spec'
/Users/koptehe/.gem/ruby/2.7.2/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:684:in `attempt_to_activate'
/Users/koptehe/.gem/ruby/2.7.2/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:254:in `process_topmost_state'
/Users/koptehe/.gem/ruby/2.7.2/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:182:in `resolve'
/Users/koptehe/.gem/ruby/2.7.2/gems/molinillo-0.8.0/lib/molinillo/resolver.rb:43:in `resolve'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-1.13.0/lib/cocoapods/resolver.rb:94:in `resolve'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-1.13.0/lib/cocoapods/installer/analyzer.rb:1082:in `block in resolve_dependencies'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-1.13.0/lib/cocoapods/user_interface.rb:64:in `section'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-1.13.0/lib/cocoapods/installer/analyzer.rb:1080:in `resolve_dependencies'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-1.13.0/lib/cocoapods/installer/analyzer.rb:125:in `analyze'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-1.13.0/lib/cocoapods/installer.rb:422:in `analyze'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-1.13.0/lib/cocoapods/installer.rb:244:in `block in resolve_dependencies'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-1.13.0/lib/cocoapods/user_interface.rb:64:in `section'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-1.13.0/lib/cocoapods/installer.rb:243:in `resolve_dependencies'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-1.13.0/lib/cocoapods/installer.rb:162:in `install!'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-1.13.0/lib/cocoapods/command/install.rb:52:in `run'
/Users/koptehe/.gem/ruby/2.7.2/gems/claide-1.1.0/lib/claide/command.rb:334:in `run'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-1.13.0/lib/cocoapods/command.rb:52:in `run'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-1.13.0/bin/pod:55:in `<top (required)>'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/bin/pod:25:in `load'
/opt/homebrew/Cellar/cocoapods/1.13.0/libexec/bin/pod:25:in `<main>'

Flutter doctor

Doctor summary (to see all details, run flutter doctor -v):

[✓] Flutter (Channel stable, 3.13.6, on macOS 14.0 23A344 darwin-arm64)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 15.0.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.3)
[✓] VS Code (version 1.83.1)
[✓] Connected device (2 available)
[✓] Network resources

Additional info

  • I tried to make rm -rf ~/.cocoapods/repos/trunk but it doesn't help
  • I tried to delete all cocoapods and install again (gem list --local | grep cocoapods then `gem uninstall
  • I tried to reload my Mac
  • I tried all combinations of flutter clean + flutter pub get -> pod install
  • I have created a new project with old pubspec.yaml and after this it throw error on pod install

pubspec.yaml

name: unknown_app
description: Unknown app
publish_to: 'none'
version: 1.0.0+1

environment:
  sdk: ">=3.0.0 <4.0.0"

dependencies:
  flutter:
    sdk: flutter
  flutter_localizations:
    sdk: flutter
  bloc: ^8.1.2
  bloc_concurrency: ^0.2.2
  equatable: ^2.0.5
  firebase_core: ^2.20.0
  intl: 0.18.1
  formz: ^0.6.0
  cupertino_icons: ^1.0.6
  flutter_bloc: ^8.1.3
  url_launcher: ^6.1.11
  flutter_svg: ^2.0.7
  geolocator: ^10.1.0
  google_maps_flutter: ^2.5.0
  google_maps_cluster_manager: ^3.0.0+1
  flutter_native_timezone: ^2.0.0
  http: ^1.1.0
  webview_flutter: ^4.4.1
  mask_text_input_formatter: ^2.4.0
  image_picker: ^1.0.4
  firebase_messaging: ^14.7.2
  flutter_local_notifications: ^16.1.0
  sentry_flutter: ^7.11.0
  in_app_review: ^2.0.6
  package_info_plus: ^4.0.2
  flutter_secure_storage: ^9.0.0
  rive: ^0.12.1
  async: ^2.11.0
  

dev_dependencies:
  bloc_test: ^9.1.3
  mocktail: ^0.3.0
  very_good_analysis: ^5.0.0+1
  flutter_test:
    sdk: flutter
  flutter_lints: ^2.0.0

flutter:
  uses-material-design: true
  generate: true

  # To add assets to your application, add an assets section, like this:
  assets:
    - assets/icons/

I want to make a pod install and run my app on the iOS.


Solution

  • TLDR;

    1. Try to update flutter
    2. Try to update cocoa with this instructions

    I fixed my problem with ... I don't know

    What happened? As I understand it, cocoa didn't have files under Flutter 3.13.6 (specifically FlutterMacOS).

    Since the error occurred, I have updated Flutter to 3.13.9 and cocoa to 1.13.4 (was 1.13.3)

    And also maybe deleting Runner.xcworkspace helped, because after I did everything according to these instructions after updating cocoa and Flutter - everything worked fine.