iosflutterxcodekotlin-multiplatformpodfile

The 'Pods-xxx' target has frameworks with conflicting names: kotlin_mpp.framework


At my company we are porting our apps to Flutter from native and for company's reasons we need to quickly get rid of the native layers all together. Now, we have a bit of a weird situation.. Flutter is integrated as a module into the native platform (I haven't caused this mess, I'm just the new Flutter/iOS dev that should sort this mess out..yay!!) and we also have a Kotlin Multiplatform module for the back end API and for which I don't have the code..

So the fastest approach I suggested is moving the native VC's into Flutter and gradually remake the screens.. My first attempt has been moving the native VCs into Flutter using PlatformView, but the whole thing works as expected as far as Flutter is not a module..(I opened an isse ion GitHub and the Flutter team have confirmed the issue). As a test I did try building a Flutter plugin which returns PlatformViews showing the Native VCs and use it in the Flutter app which does work even when Flutter is used as a module in the Native project.

Now of course I need to install all the Pods that the native VCs use, resulting in having a few doubles, (eg: pod 'TouchDraw', '2.1.2' in Xcode Podfile and s.dependency 'TouchDraw', '2.1.2' in the Flutter plugin's podspec file). Xcode doesn't complain about the double pods except for the Kotlin Multiplatform module with the error: The 'Pods-xxx' target has frameworks with conflicting names: kotlin_mpp.framework. which in Xcode's Podfile is installed as : pod 'kotlin_mpp', :path => './kotlin-mpp/kotlin-mpp' and in the Flutter plugin's podspec file is installed as s.ios.vendored_frameworks = 'kotlin-mpp/kotlin-mpp/build/cocoapods/framework/kotlin_mpp.framework'.

Is there a way to edit the Flutter plugin one so that it has a different name from the one used in Xcode or am I installing it wrong in the Flutter plugin's podspec file causing this name conflict?

Many thanks for your help and time. This is the podspec file:

Pod::Spec.new do |s|
  s.name             = 'native_screens_plugin'
  s.version          = '0.0.1'
  s.summary          = 'A new Flutter plugin project.'
  s.description      = <<-DESC
A new Flutter plugin project.
                       DESC
  s.homepage         = 'http://example.com'
  s.license          = { :file => '../LICENSE' }
  s.author           = { 'Your Company' => 'email@example.com' }
  s.source           = { :path => '.' }
  s.source_files = 'Classes/**/*'
  s.dependency 'Flutter'
  s.platform = :ios, '14.0'



  # Flutter.framework does not contain a i386 slice.
  s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' }
  s.swift_version = '5.0'


  s.dependency 'MBProgressHUD', '1.2.0'
  s.dependency 'PanModal', '1.2.7'
  s.dependency 'TouchDraw', '2.1.2'
  s.dependency 'MaterialComponents/Snackbar', '122.0.1'
  s.dependency 'MaterialComponents/TextFields', '122.0.1'
  s.dependency 'MaterialComponents/TextFields+Theming', '122.0.1'
  s.dependency 'MaterialComponents/Cards', '122.0.1'
  s.dependency 'MaterialComponents/BottomNavigation', '122.0.1'
  s.dependency 'MaterialComponents/Chips', '122.0.1'
  s.dependency 'MaterialComponents/Chips+Theming', '122.0.1'
  s.dependency 'MaterialComponents/Tabs+TabBarView', '122.0.1'
  s.dependency 'MaterialComponents/Buttons', '122.0.1'
  s.dependency 'YPImagePicker', '5.2.2'
  s.dependency 'Firebase/Crashlytics', '10.9.0'
  s.dependency 'SwiftRichString', '3.7.2'
  s.dependency 'IGListKit', '4.0.0'
  # s.ios.vendored_frameworks = 'kotlin-mpp/build/cocoapods/framework/kotlin_mpp.framework'
  s.ios.vendored_frameworks = 'kotlin-mpp/kotlin-mpp/build/cocoapods/framework/kotlin_mpp.framework'




  # s.vendored_frameworks = 'kotlin-mpp'

  # s.source = { :path  => './kotlin-mpp/kotlin-mpp' }
  # s.vendored_frameworks = 'kotlin-mpp'

  # s.ios.dependency 'native_screens_plugin/kotlin-mpp'
  # s.subspec 'kotlin-mpp' do |ss|
  #   ss.source_files = 'kotlin-mpp/**/*.{h,m}'
  # end




end

Solution

  • Ok, so after quite a bit I tried not to declare it in the native Pod file and the problem was resolved. The reason why this solved it is a bit unclear still, as other Pods are declared both in the native Pod file and the Plugin podspec file.