首页 > 解决方案 > GoogleMaps 作为间接依赖导致构建错误

问题描述

出于说明目的,两个Xcode项目由Cocoapods创建和依赖管理。第一个是iOS Apps项目,另一个是依赖框架在没有GoogleMaps的情况下,这两个项目都可以正常构建和运行。如果存在GoogleMaps作为第一个项目的间接依赖项会导致错误,这里是依赖关系树:

AcademiaMainAPP/
├─ TARGETS/AcademiaMainAPP       [Error: Multiple commands produce for Assets.car]
└─ PODS/
   └─ AcademiaMainGUI/
      ├─ TARGETS/AcademiaMainDMO [No error, build & run successfully]
      └─ PODS/
         ├─ GoogleMaps
         └─ AcademiaCoreLIB

将 GoogleMaps 的案例构建为间接依赖项:

默认目标的iOS 应用项目构建错误

错误:

Multiple commands produce '/Users/Academia/Library/Developer/Xcode/DerivedData/AcademiaMainAPP-dchavmxvfznhbifvdocjhrxhitug/Build/Products/Debug-iphonesimulator/Academia.app/Assets.car':
1) Target 'AcademiaMainAPP' (project 'AcademiaMainAPP') has compile command with input '/opt/dev/ios_workspace/academia-main-iosapp/AcademiaMainAPP/Preview Content/Preview Assets.xcassets'
2) That command depends on command in Target 'AcademiaMainAPP' (project 'AcademiaMainAPP'): script phase "[CP] Copy Pods Resources"

警告:

duplicate output file '/Users/Academia/Library/Developer/Xcode/DerivedData/AcademiaMainAPP-dchavmxvfznhbifvdocjhrxhitug/Build/Products/Debug-iphonesimulator/Academia.app/Assets.car'
on task: PhaseScriptExecution [CP] Copy Pods Resources /Users/Academia/Library/Developer/Xcode/DerivedData/AcademiaMainAPP-dchavmxvfznhbifvdocjhrxhitug/Build/Intermediates.noindex/AcademiaMainAPP.build/Debug-iphonesimulator/AcademiaMainAPP.build/Script-3D735383E09B1F357AA7768E.sh

询问?

现在我们正在使用Xcode 11.4.1。实际上我们没有使用这样的Assets.cars.static_framework = truePodspec中为GoogleMaps添加。有关详细信息,请查找我们的PodfilePodspec作为自爆。事实上,我们需要知道PodfilePodspec中是否有任何错误或缺少配置。我们对已经解决此类问题的专家的唯一疑问请指导我们解决此问题。


1.AcademiaMainAPP/Podfile:

platform :ios, '13.0'

target 'AcademiaMainAPP' do
  use_frameworks!

  # Pods for AcademiaMainAPP
  pod 'AcademiaMainGUI', :git => 'git.chorke.org:academia/academia-main-iosgui.git'
  pod 'AcademiaCoreLIB', :git => 'git.chorke.org:academia/academia-core-ioslib.git'

  target 'AcademiaMainAPPTests' do
    # Pods for testing
  end
end

2.a AcademiaMainGUI/Podfile:

platform :ios, '13.0'

target 'AcademiaMainGUI' do
  use_frameworks!

  # Pods for AcademiaMainGUI
  pod 'AcademiaCoreLIB', :git => 'git.chorke.org:academia/academia-core-ioslib.git'
  pod 'GoogleMaps', '~> 3.8.0'

  target 'AcademiaMainGUITests' do
    # Pods for testing
  end

  target 'AcademiaMainDMO' do
    target 'AcademiaMainDMOTests' do
      # Pods for testing
    end
    target 'AcademiaMainDMOUITests' do
      # Pods for testing
    end
  end
end

2.b AcademiaMainGUI.podspec:

Pod::Spec.new do |s|
  s.name        = 'AcademiaMainGUI'
  s.module_name = 'AcademiaMainGUI'
  s.version     = '1.0.0'
  s.source      = { :git => 'git.chorke.org:academia/academia-main-iosgui.git', :tag => "v#{s.version}" }

  s.homepage          = 'https://cdn.chorke.org/docs/academia/swift/main/academia-main-iosgui'
  s.documentation_url = 'https://cdn.chorke.org/docs/academia/swift/main/academia-main-iosgui'
  s.source_files      = 'AcademiaMainGUI', 'AcademiaMainGUI/**/*.{h,m,swift}'
  s.authors           = {'Chorke Academia' => 'academia@chorke.org'}
  s.resources         = ['AcademiaMainGUI/Resource/*.xcassets']
  s.license           = { :type => 'MIT', :file => 'LICENSE' }
  s.social_media_url  = "https://twitter.com/chorkeinc"
  s.swift_versions    = ['5.0', '5.1']

  s.requires_arc              = true
  s.static_framework          = true
  s.ios.deployment_target     = '13.0'
  s.osx.deployment_target     = '10.12'
  s.tvos.deployment_target    = '10.0'
  s.watchos.deployment_target = '3.0'

  s.summary       = 'Swift Classess, Structures and Utilities for SwiftUI & UIKit'
  s.description   = <<-DESC
  AcademiaMainGUI is the dependnecy for the AcademiaMainAPP by the Academian for the Academian.
  SwiftUI and UIKit related reusable protocols, extensions, classess, strutures, utilites,
  functions and constants developed for encapsulation, security and agile software
  development for Swift. Minimizing the learning curve and the development costing of
  an Academian. Academia developed such library targeting Multi-Lingual Academian.
                  DESC

  s.dependency    'AcademiaCoreLIB'
  s.dependency    'GoogleMaps'
end

标签: iosxcodecocoapodsswiftuigoogle-maps-sdk-ios

解决方案


推荐阅读