颤振项目Pod安装失败,错误419

时间:2020-02-29 22:58:15

标签: ios flutter cocoapods pod build-error

我最近在iOS平台上遇到问题。我可以创建一个示例计数器应用程序并运行它,但是当我尝试运行自己的项目时,该项目包含一些库,包括firebase,google_sign_in,google map等,pod install总是失败。

错误消息是:

### Stack

```
   CocoaPods : 1.9.0
        Ruby : ruby 2.3.7p456 (2018-03-28 revision 63024) [universal.x86_64-darwin18]
    RubyGems : 2.5.2.3
        Host : Mac OS X 10.14.5 (18F132)
       Xcode : 11.3.1 (11C504)
         Git : git version 2.24.1
Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib
Repositories : trunk - CDN - https://cdn.cocoapods.org/
```

### Plugins

```
cocoapods-deintegrate : 1.0.4
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.0
cocoapods-stats       : 1.1.0
cocoapods-trunk       : 1.4.1
cocoapods-try         : 1.1.0
```

### Podfile

```ruby
# 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
```

### Error

```
JSON::ParserError - 419: unexpected token at '"src/core/'
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/json/common.rb:156:in
`parse'
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/json/common.rb:156:in
`parse'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-core-1.9.0/lib/cocoapods-core/specification/json.rb:61:in
`from_json'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-core-1.9.0/lib/cocoapods-core/specification.rb:742:in
`from_string'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-core-1.9.0/lib/cocoapods-core/specification.rb:716:in
`from_file'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-core-1.9.0/lib/cocoapods-core/source.rb:186:in
`specification'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-core-1.9.0/lib/cocoapods-core/specification/set.rb:58:in
`block in specification_name'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-core-1.9.0/lib/cocoapods-core/specification/set.rb:56:in
`each'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-core-1.9.0/lib/cocoapods-core/specification/set.rb:56:in
`specification_name'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-core-1.9.0/lib/cocoapods-core/cdn_source.rb:216:in `search'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-core-1.9.0/lib/cocoapods-core/source/aggregate.rb:83:in
`block in search'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-core-1.9.0/lib/cocoapods-core/source/aggregate.rb:83:in
`select'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-core-1.9.0/lib/cocoapods-core/source/aggregate.rb:83:in
`search'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.9.0/lib/cocoapods/resolver.rb:416:in
`create_set_from_sources'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.9.0/lib/cocoapods/resolver.rb:385:in `find_cached_set'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.9.0/lib/cocoapods/resolver.rb:360:in
`specifications_for_dependency'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.9.0/lib/cocoapods/resolver.rb:165:in `search_for'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.9.0/lib/cocoapods/resolver.rb:274:in `block in
sort_dependencies'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.9.0/lib/cocoapods/resolver.rb:267:in `each'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.9.0/lib/cocoapods/resolver.rb:267:in `sort_by'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.9.0/lib/cocoapods/resolver.rb:267:in `sort_dependencies'
/Library/Ruby/Gems/2.3.0/gems/molinillo-0.6.6/lib/molinillo/delegates/specification_provider.rb:53:in
`block in sort_dependencies'
/Library/Ruby/Gems/2.3.0/gems/molinillo-0.6.6/lib/molinillo/delegates/specification_provider.rb:70:in
`with_no_such_dependency_error_handling'
/Library/Ruby/Gems/2.3.0/gems/molinillo-0.6.6/lib/molinillo/delegates/specification_provider.rb:52:in
`sort_dependencies'
/Library/Ruby/Gems/2.3.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:754:in
`push_state_for_requirements'
/Library/Ruby/Gems/2.3.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:746:in
`require_nested_dependencies_for'
/Library/Ruby/Gems/2.3.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:729:in `activate_new_spec'
/Library/Ruby/Gems/2.3.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:686:in
`attempt_to_activate'
/Library/Ruby/Gems/2.3.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:254:in
`process_topmost_state'
/Library/Ruby/Gems/2.3.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:182:in `resolve'
/Library/Ruby/Gems/2.3.0/gems/molinillo-0.6.6/lib/molinillo/resolver.rb:43:in `resolve'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.9.0/lib/cocoapods/resolver.rb:94:in `resolve'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.9.0/lib/cocoapods/installer/analyzer.rb:1065:in `block in
resolve_dependencies'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.9.0/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.9.0/lib/cocoapods/installer/analyzer.rb:1063:in
`resolve_dependencies'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.9.0/lib/cocoapods/installer/analyzer.rb:124:in `analyze'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.9.0/lib/cocoapods/installer.rb:410:in `analyze'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.9.0/lib/cocoapods/installer.rb:235:in `block in
resolve_dependencies'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.9.0/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.9.0/lib/cocoapods/installer.rb:234:in
`resolve_dependencies'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.9.0/lib/cocoapods/installer.rb:156:in `install!'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.9.0/lib/cocoapods/command/install.rb:52:in `run'
/Library/Ruby/Gems/2.3.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.9.0/lib/cocoapods/command.rb:52:in `run'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.9.0/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:22:in `load'
/usr/local/bin/pod:22:in `<main>'
```

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

[!] Oh no, an error occurred.

Search for existing GitHub issues similar to yours:
https://github.com/CocoaPods/CocoaPods/search?q=419%3A+unexpected+token+at+%27%22src%2Fcore%2F%27&typ
e=Issues

If none exists, create a ticket, with the template displayed above, on:
https://github.com/CocoaPods/CocoaPods/issues/new

Be sure to first read the contributing guide for details on how to properly submit a ticket:
https://github.com/CocoaPods/CocoaPods/blob/master/CONTRIBUTING.md

Don't forget to anonymize any private data!

Looking for related issues on cocoapods/cocoapods...
Found no similar issues. To create a new issue, please visit:
https://github.com/cocoapods/cocoapods/issues/new

扑扑医生的消息:

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.12.13+hotfix.8, on Mac OS X 10.14.5 18F132, locale en-NZ)
[✗] Android toolchain - develop for Android devices
 ✗ Unable to locate Android SDK.
  Install Android Studio from: https://developer.android.com/studio/index.html
  On first launch it will assist you in installing the Android SDK components.
  (or visit https://flutter.dev/setup/#android-setup for detailed instructions).
  If the Android SDK has been installed to a custom location, set ANDROID_HOME to that location.
  You may also want to add it to your PATH environment variable.

[✓] Xcode - develop for iOS and macOS (Xcode 11.3.1)
[!] Android Studio (not installed)
[✓] Connected device (2 available)

! Doctor found issues in 2 categories.

尽管我没有在Mac中安装Android SDK,但我知道Android项目可以正常运行,并且已上传到Google Play。

我正在按照这些库中的说明进行操作,在info.plist中插入某些配置,然后将“ GoogleService-Info.plist”放置在适当的位置。

我对pod在Mac中的工作方式不是很熟悉,但是请告诉我您是否有任何线索,我将不胜感激!

谢谢

1 个答案:

答案 0 :(得分:0)

事实证明,我需要将pod降级到1.7.5版,我想这个问题已经解决了。