Flutter: Multiple commands produce '/build/ios/Debug-iphonesimulator/Runner.app/Frameworks/Flutter.framework

Created on 16 Aug 2018  ·  50Comments  ·  Source: flutter/flutter

When I want to debug the application in MacOs environment, it throw such error:

Multiple commands produce '/build/ios/Debug-iphonesimulator/Runner.app/Frameworks/Flutter.framework
1) Target 'Runner' has copy command from '/ios/Flutter/Flutter.framework' to '/build/ios/Debug-iphonesimulator/Runner.app/Frameworks/Flutter.framework'
2) That command depends on command in Target 'Runner': script phase “[CP] Embed Pods Frameworks”
warning: ignoring duplicated output file: '//build/ios/Debug-iphonesimulator/Runner.app/Frameworks/Flutter.framework' (in target 'Runner')
note: Using new build systemnote: Planning buildnote: Constructing build description

Mac 10.14 Beta
Xcode 10 beta

How to fix it? Thanks a lot

annoyance crowd platform-ios crash tool

Most helpful comment

I was able to fix it by opening the Runner workspace project in Xcode 10. Then navigate to File, Workspace Settings and change the build system to Legacy Build System.

schermafbeelding 2018-08-16 om 14 10 10

All 50 comments

Can you please provide exact steps how to reproduce?
How did you create the project?
What files did you change, what changes did you make?

Please add the output of flutter doctor -v.

I was able to fix it by opening the Runner workspace project in Xcode 10. Then navigate to File, Workspace Settings and change the build system to Legacy Build System.

schermafbeelding 2018-08-16 om 14 10 10

thanks a lot! it works.

Affected projects

This issue affects all Flutter projects built using Xcode 10 that have a dependency on CocoaPods -- typically this means those that rely on plugins.

Workarounds

There are two workarounds:

  • Option 1: Use the legacy build system . As noted by @gi097, open ios/Runner.xcworkspace, and change the build system to Legacy Build System.
  • Option 2: Use the new Xcode 10 build system.

    1. Open ios/Runner.xcworkspace

    2. Select the Runner project in the project navigator sidebar.

    3. In the main view, select the Runner target, then select the Build Phases tab.

    4. Expand the Embed Frameworks phase and select Flutter.framework from the embedded frameworks list.

    5. Click - to remove Flutter.framework from the list (be sure to keep App.framework).

Root cause

When plugins are in use, there are two competing build actions that copy Flutter.framework into the build application Frameworks directory:

  1. The Embed Frameworks build phase for the Runner project
  2. The [CP] Embed Pods Frameworks build phase that pod install creates in the project.

Item (1) is there to ensure the framework is copied into the built app in the case where there are no plugins (and therefore no CocoaPods integration in the Xcode project). Item (2) is there because Flutter's podspec declares Flutter.framework as a vended_framework, and CocoaPods automatically adds a copy step for each such vended_framework in the transitive closure of CocoaPods dependencies.

Immediate fix

The immediate fix is for us to find a way to automatically opt back in to the legacy build fix until a longer-term better solution is in place. Previous betas supported -useNewBuildSystem=NO or -useModernBuildSystem=NO but looks like this is removed in the GM build. Looks like currently the way to do this is to add a key-value pair (<key>BuildSystemType</key><string>Original</string>) to ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings.

Longer-term fix

The simplest option would be to eliminate Flutter.framework from the Embed Frameworks step above and always rely on pod install, even in the case where there are no plugin dependencies. We'd need to update Flutter tool to automatically edit existing projects to remove Flutter.framework from the Embed Frameworks step.

pro: simpler code. con: makes cocoapods a required install step for Flutter development, first run involves a huge and very slow download of their repo.

A slightly nicer option would be for us to automatically detect whether the project uses plugins or not, and edit the Xcode project to check for and remove Flutter.framework from the Embed Frameworks step automatically if plugins are in use or add it if not.

pro: better user experience. con: more complex code.

Either way, we need some mechanism to automatically edit the project.pbxproj file and remove the framework from the embed frameworks build step. Supporting adding it back in isn't much incremental work and results in a better experience.

/cc @tvolkert @gspencergoog @dnfield

Sorry, I didn't intent to flood your issue tracker.

I followed this resolution #20685

but now it results in the following error

captura de tela 2018-09-18 as 10 06 38 am

Anyone have any idea how to solve this?
@gi097 @cbracken @zoechi @sidealice @hungrymonkey

@tiagosito A patch will be landing momentarily on the master branch. For the time being see the workarounds listed in my comment above.

@tiagosito A patch will be landing momentarily on master. For the time being see the workarounds listed in my comment above.

@cbracken I followed option 2 that you reported #20685

But I had this little problem #21989

Was solved in this way #21989

I'm not using the master channel, when the patch you mentioned is released, will I be hit with the same solution on the beta channel?

@cbracken and @gi097 for now thank you so much

also had this problem earlier today after going to iOS 12, which then required xcode 10, which then broke flutter. option 2 above worked, but you should wipe out your package build cache:

~/flutter/.pub-cache/hosted/
flutter clean
flutter packages get

or else you'll be scratching your head.

The 'immediate fix' in my comment above has landed on master. Working on getting this to dev channel ASAP.

FYI this has now landed on the dev channel.

Great!
Btw, how do we apply this patch in existing projects? Simply by doing flutter upgrade?

@tadejkan You'll want to run flutter channel dev to switch to dev channel then flutter upgrade.

@cbracken a doubt that remains is ... we will use the legacy mode of compilation or the patch will already correct for the new mode of compilation.

In other words, is the patch applying the solution of step 1 or step 2 that you presented here or is it already a definitive solution and when this patch will be applied to the beta channel?

@tiagosito the patch I landed implements the 'immediate fix' above (opt back into the pre-Xcode 10 build system) which buys us time to implement a fix that does this the right way. There's an alternative quick-fix for this, but it would make CocoaPods a requirement for all Flutter apps built on iOS (even those that don't rely on plugins). Given the initial download size/time for a first run of CocoaPods, I'd really prefer to avoid going that route.

The proper solution for this is for us to detect when CocoaPods/plugins are in use and rely on CocoaPods to embed Flutter.framework into the output app in those cases, and for all other cases, invoke the embed step ourselves. I'll be working on that next.

I am facing issues building ios which I cannot solve for 4 full days now... getting very helpless now as I tried so many things and combinations; getting very confused and sad.
This is the latest error after multiple different errors:

duplicate symbol _OBJC_IVAR_$_MDMPasscodeCache._localAuthenticationInfo in: /Volumes/flutter/ios/Pods/GoogleMobileVision/Detector/Frameworks/GoogleMobileVision.framework/GoogleMobileVision(MDMPasscodeCache_f189776e75765630b82721fafea64052.o) /Volumes/flutter/ios/Pods/GoogleSignIn/Frameworks/GoogleSignIn.framework/GoogleSignIn(MDMPasscodeCache_42de90102bb6814d03833694aafcc99d.o) duplicate symbol _OBJC_IVAR_$_MDMPasscodeCache._keychainInfo in: /Volumes/flutter/ios/Pods/GoogleMobileVision/Detector/Frameworks/GoogleMobileVision.framework/GoogleMobileVision(MDMPasscodeCache_f189776e75765630b82721fafea64052.o) /Volumes/flutter/ios/Pods/GoogleSignIn/Frameworks/GoogleSignIn.framework/GoogleSignIn(MDMPasscodeCache_42de90102bb6814d03833694aafcc99d.o) duplicate symbol _OBJC_IVAR_$_MDMPasscodeCache._hasLocalAuthentication in: /Volumes/flutter/ios/Pods/GoogleMobileVision/Detector/Frameworks/GoogleMobileVision.framework/GoogleMobileVision(MDMPasscodeCache_f189776e75765630b82721fafea64052.o) /Volumes/flutter/ios/Pods/GoogleSignIn/Frameworks/GoogleSignIn.framework/GoogleSignIn(MDMPasscodeCache_42de90102bb6814d03833694aafcc99d.o) duplicate symbol _OBJC_IVAR_$_MDMPasscodeCache._hasKeychain in: /Volumes/flutter/ios/Pods/GoogleMobileVision/Detector/Frameworks/GoogleMobileVision.framework/GoogleMobileVision(MDMPasscodeCache_f189776e75765630b82721fafea64052.o) /Volumes/flutter/ios/Pods/GoogleSignIn/Frameworks/GoogleSignIn.framework/GoogleSignIn(MDMPasscodeCache_42de90102bb6814d03833694aafcc99d.o) duplicate symbol _OBJC_IVAR_$_MDMPasscodeCache._cachedState in: /Volumes/flutter/ios/Pods/GoogleMobileVision/Detector/Frameworks/GoogleMobileVision.framework/GoogleMobileVision(MDMPasscodeCache_f189776e75765630b82721fafea64052.o) /Volumes/flutter/ios/Pods/GoogleSignIn/Frameworks/GoogleSignIn.framework/GoogleSignIn(MDMPasscodeCache_42de90102bb6814d03833694aafcc99d.o) duplicate symbol _OBJC_IVAR_$_MDMPasscodeCache._keychainExpireTime in: /Volumes/flutter/ios/Pods/GoogleMobileVision/Detector/Frameworks/GoogleMobileVision.framework/GoogleMobileVision(MDMPasscodeCache_f189776e75765630b82721fafea64052.o) /Volumes/flutter/ios/Pods/GoogleSignIn/Frameworks/GoogleSignIn.framework/GoogleSignIn(MDMPasscodeCache_42de90102bb6814d03833694aafcc99d.o) duplicate symbol _OBJC_CLASS_$_MDMPasscodeCache in: /Volumes/flutter/ios/Pods/GoogleMobileVision/Detector/Frameworks/GoogleMobileVision.framework/GoogleMobileVision(MDMPasscodeCache_f189776e75765630b82721fafea64052.o) /Volumes/flutter/ios/Pods/GoogleSignIn/Frameworks/GoogleSignIn.framework/GoogleSignIn(MDMPasscodeCache_42de90102bb6814d03833694aafcc99d.o) duplicate symbol _OBJC_METACLASS_$_MDMPasscodeCache in: /Volumes/flutter/ios/Pods/GoogleMobileVision/Detector/Frameworks/GoogleMobileVision.framework/GoogleMobileVision(MDMPasscodeCache_f189776e75765630b82721fafea64052.o) /Volumes/flutter/ios/Pods/GoogleSignIn/Frameworks/GoogleSignIn.framework/GoogleSignIn(MDMPasscodeCache_42de90102bb6814d03833694aafcc99d.o) duplicate symbol _OBJC_IVAR_$_MDMPasscodeCache._hasEnteredBackground in: /Volumes/flutter/ios/Pods/GoogleMobileVision/Detector/Frameworks/GoogleMobileVision.framework/GoogleMobileVision(MDMPasscodeCache_f189776e75765630b82721fafea64052.o) /Volumes/flutter/ios/Pods/GoogleSignIn/Frameworks/GoogleSignIn.framework/GoogleSignIn(MDMPasscodeCache_42de90102bb6814d03833694aafcc99d.o) duplicate symbol _OBJC_IVAR_$_MDMPasscodeState._status in: /Volumes/flutter/ios/Pods/GoogleMobileVision/Detector/Frameworks/GoogleMobileVision.framework/GoogleMobileVision(MDMPasscodeState_d2697588db599ad1e82d46f342216cee.o) /Volumes/flutter/ios/Pods/GoogleSignIn/Frameworks/GoogleSignIn.framework/GoogleSignIn(MDMPasscodeState_adbe96d99863168799049cc0f0164c6d.o) duplicate symbol _OBJC_IVAR_$_MDMPasscodeState._info in: /Volumes/flutter/ios/Pods/GoogleMobileVision/Detector/Frameworks/GoogleMobileVision.framework/GoogleMobileVision(MDMPasscodeState_d2697588db599ad1e82d46f342216cee.o) /Volumes/flutter/ios/Pods/GoogleSignIn/Frameworks/GoogleSignIn.framework/GoogleSignIn(MDMPasscodeState_adbe96d99863168799049cc0f0164c6d.o) duplicate symbol _OBJC_CLASS_$_MDMPasscodeState in: /Volumes/flutter/ios/Pods/GoogleMobileVision/Detector/Frameworks/GoogleMobileVision.framework/GoogleMobileVision(MDMPasscodeState_d2697588db599ad1e82d46f342216cee.o) /Volumes/flutter/ios/Pods/GoogleSignIn/Frameworks/GoogleSignIn.framework/GoogleSignIn(MDMPasscodeState_adbe96d99863168799049cc0f0164c6d.o) duplicate symbol _OBJC_METACLASS_$_MDMPasscodeState in: /Volumes/flutter/ios/Pods/GoogleMobileVision/Detector/Frameworks/GoogleMobileVision.framework/GoogleMobileVision(MDMPasscodeState_d2697588db599ad1e82d46f342216cee.o) /Volumes/flutter/ios/Pods/GoogleSignIn/Frameworks/GoogleSignIn.framework/GoogleSignIn(MDMPasscodeState_adbe96d99863168799049cc0f0164c6d.o) ld: 13 duplicate symbols for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

ld: 13 duplicate symbols for architecture x86_64
Launching lib/main.dart on iPhone XS Max in debug mode...
Xcode build done.
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
warning: The iOS Simulator deployment target is set to 4.3, but the range of supported deployment target versions for this platform is 8.0 to 12.0. (in target 'nanopb')
warning: The iOS Simulator deployment target is set to 6.0, but the range of supported deployment target versions for this platform is 8.0 to 12.0. (in target 'GoogleUtilities')
warning: The iOS Simulator deployment target is set to 7.0, but the range of supported deployment target versions for this platform is 8.0 to 12.0. (in target 'GTMSessionFetcher')
warning: The iOS Simulator deployment target is set to 7.0, but the range of supported deployment target versions for this platform is 8.0 to 12.0. (in target 'Protobuf')
warning: The iOS Simulator deployment target is set to 5.0, but the range of supported deployment target versions for this platform is 8.0 to 12.0. (in target 'leveldb-library')
warning: The iOS Simulator deployment target is set to 5.0, but the range of supported deployment target versions for this platform is 8.0 to 12.0. (in target 'BoringSSL')
warning: The iOS Simulator deployment target is set to 7.0, but the range of supported deployment target versions for this platform is 8.0 to 12.0. (in target 'gRPC-RxLibrary')
warning: The iOS Simulator deployment target is set to 7.0, but the range of supported deployment target versions for this platform is 8.0 to 12.0. (in target 'gRPC-Core')
warning: The iOS Simulator deployment target is set to 7.0, but the range of supported deployment target versions for this platform is 8.0 to 12.0. (in target 'gRPC-C++')
warning: The iOS Simulator deployment target is set to 7.0, but the range of supported deployment target versions for this platform is 8.0 to 12.0. (in target 'gRPC-gRPCCertificates')
warning: The iOS Simulator deployment target is set to 7.0, but the range of supported deployment target versions for this platform is 8.0 to 12.0. (in target 'gRPC')
warning: The iOS Simulator deployment target is set to 7.0, but the range of supported deployment target versions for this platform is 8.0 to 12.0. (in target 'gRPC-ProtoRPC')
warning: The iOS Simulator deployment target is set to 6.0, but the range of supported deployment target versions for this platform is 8.0 to 12.0. (in target 'cloud_firestore')
duplicate symbol __channel in:
/Users/erikiado/Code/internals/flutter/find_word/build/ios/Debug-iphonesimulator/audioplayers/libaudioplayers.a(AudioplayersPlugin.o)
/Users/erikiado/Code/internals/flutter/find_word/build/ios/Debug-iphonesimulator/firebase_admob/libfirebase_admob.a(FLTMobileAd.o)
ld: 1 duplicate symbol for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
note: Using new build systemnote: Planning buildnote: Constructing build description
Could not build the application for the simulator.
Error launching application on iPhone XS Max.
Exited (sigterm)

@erikiado and @LiveRock your issues (duplicate symbols on x86_64 simulator builds) look unrelated to this one. Please track progress on those on #22020.

ETA for Beta channel?

@lukepighetti this is now pushed to beta channel (as of moments ago). flutter upgrade away!

Fixed my issue. Thank you!

@sidealice is this fixed for you as well?

thanks, solution 2 worked!

Without additional information, we are unfortunately not sure how to resolve this issue. We are therefore reluctantly going to close this bug for now. Please don't hesitate to comment on the bug if you have any more information for us; we will reopen it right away!
Thanks for your contribution.
cc @Hixie

thanks bro ! it works.

I'm still getting this issue on Flutter stable channel v1.0.0
Is the fix supposed to be in stable?

[✓] Flutter (Channel stable, v1.0.0, on Mac OS X 10.14.1 18B75, locale en-GB)
• Flutter version 1.0.0 at /usr/local/share/flutter
• Framework revision 5391447fae (3 weeks ago), 2018-11-29 19:41:26 -0800
• Engine revision 7375a0f414
• Dart version 2.1.0 (build 2.1.0-dev.9.4 f9ebf21297)

[✓] iOS toolchain - develop for iOS devices (Xcode 10.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 10.1, Build version 10B61
• ios-deploy 2.0.0
• CocoaPods version 1.5.3

@JannieT please check dev as well.
I don't know if it should be in stable, but if it works on dev the answer is probably "no".

Thanks! Just to confirm, the fix is in Stable v1.0.0
I ran into the issue because I was opening the .xcodeproject file instead of the documented .xcworkspace when trying to build an Archive.

I have the same problem right now.

error: Multiple commands produce '/Users/n.gendron/Library/Developer/Xcode/DerivedData/Runner-eilfeqiwvjuvbghjmkepqybkaoja/ArchiveIntermediates/Runner/InstallationBuildProductsLocation/Applications/Runner.app/Frameworks/Flutter.framework':
1) Target 'Runner' has copy command from '/Users/n.gendron/Documents/GitLab/techno_store/ios/Flutter/Flutter.framework' to '/Users/n.gendron/Library/Developer/Xcode/DerivedData/Runner-eilfeqiwvjuvbghjmkepqybkaoja/ArchiveIntermediates/Runner/InstallationBuildProductsLocation/Applications/Runner.app/Frameworks/Flutter.framework'
2) That command depends on command in Target 'Runner': script phase “[CP] Embed Pods Frameworks”
[✓] Flutter (Channel dev, v1.2.2, on Mac OS X 10.13.6 17G5019, locale fr-CA)
    • Flutter version 1.2.2 at /Library/flutter
    • Framework revision 007a415c2a (5 days ago), 2019-02-21 20:22:47 -0800
    • Engine revision f1f19bba8f
    • Dart version 2.2.0 (build 2.2.0-dev.2.1 c92d5ca288)

[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at /Users/n.gendron/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)
    • All Android licenses accepted.

[✓] iOS toolchain - develop for iOS devices (Xcode 10.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 10.1, Build version 10B61
    • ios-deploy 1.9.4
    • CocoaPods version 1.6.1

[✓] Android Studio (version 3.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 33.1.1
    • Dart plugin version 182.5215
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)

[✓] VS Code
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 2.12.2

[✓] Connected device (1 available)
    • iPad de TechnoSolutions • 3e430eb4db265d124e9684f487cc542f2442ed1d • ios • iOS 10.3.3

• No issues found!

I tried the Legacy Build System, but then I had another problem. I also tried to remove Flutter.framework, but the error is the same.

#import <barcode_scan/BarcodeScanPlugin.h> # 'barcode_scan/BarcodeScanPlugin.h' file not found

Affected plugin is barcode_scan.


What resolved it for me is https://github.com/apptreesoftware/flutter_barcode_reader/issues/44#issuecomment-460415307.

open -a Xcode ios

Re-opening as we've only landed the workaround at this point, not the long-term fix to move to the new build system.

Without additional information, we are unfortunately not sure how to resolve this issue. We are therefore reluctantly going to close this bug for now. Please don't hesitate to comment on the bug if you have any more information for us; we will reopen it right away!
Thanks for your contribution.

helps me to make flutter clean then build through android studio

[✓] Flutter (Channel beta, v1.3.8, on Mac OS X 10.14.4 18E226, locale en-AU)
    • Flutter version 1.3.8 at /Users/yantsui/Installs/flutter
    • Framework revision e5b1ed7a7f (6 weeks ago), 2019-03-06 14:23:37 -0800
    • Engine revision f4951df193
    • Dart version 2.2.1 (build 2.2.1-dev.0.0 571ea80e11)

[✗] 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.io/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.


[✓] iOS toolchain - develop for iOS devices (Xcode 10.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 10.2, Build version 10E125
    • ios-deploy 1.9.4
    • CocoaPods version 1.6.1

[!] Android Studio (not installed)
    • Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.io/setup/#android-setup for detailed instructions).

[✓] IntelliJ IDEA Ultimate Edition (version 2018.3.5)
    • IntelliJ at /Applications/IntelliJ IDEA.app
    • Flutter plugin version 34.0.2
    • Dart plugin version 183.5912.23

[!] VS Code (version 1.33.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    ✗ Flutter extension not installed; install from
      https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (1 available)
    • iPhone Xʀ • 39D838DF-E49E-4F0A-8F40-B73C91700F6E • ios • com.apple.CoreSimulator.SimRuntime.iOS-12-2 (simulator)

! Doctor found issues in 3 categories.
flutter clean
flutter build ios
Xcode 10 -> Product -> Clean Build Folder
Xcode 10 -> Product -> Run

Error in Xcode:

Showing All Messages
:-1: Multiple commands produce '/Users/meow/Documents/meow/crystal/build/ios/Debug-iphonesimulator/Runner.app/Frameworks/Flutter.framework':
1) Target 'Runner' has copy command from '/Users/meow/Documents/meow/crystal/ios/Flutter/Flutter.framework' to '/Users/meow/Documents/meow/crystal/build/ios/Debug-iphonesimulator/Runner.app/Frameworks/Flutter.framework'
2) That command depends on command in Target 'Runner': script phase “[CP] Embed Pods Frameworks”

Fixed:
Ran open -a Xcode ios but seems like it didn't work.
So I opened the project in Xcode using Runner.xcworkspace instead and it worked.

This issue still happens for me, even when I open the project through the workspace. Only changing the build system to legacy seems to fix it.

We can also leverage the CocoaPods installation option disable_input_output_paths, which removes the input and output files from the [CP] Emded Pods Framework build phase. That installation option was added because the new Xcode build system failed to run the script even when the input files were touched. See https://www.ralfebert.de/ios/blog/cocoapods-clean-input-output-files.

Pros:

  • Xcode projects will use the new build system without compilation errors. Xcode has been threatening to yank legacy build support, so Flutter will be ready when that happens.
  • Simple fix.
  • No additional logic to decide whether to include Flutter.framework in the Embed Frameworks build phase since it will always be included.
  • Will not require CocoaPods to become a dependency if project is vanilla Flutter without packages.

Cons:

  • The Pods-Runner-frameworks.sh script will run on every build, even when Flutter.framework does not change. On my 2018 MacBook Pro this adds ~1 second to the build.
  • If the new Xcode build system bug is addressed, CocoaPods may remove that installation option and the duplicate framework copies issue will reassert itself.
  • Minimum CocoaPods version will need to increase from 1.0.0 to 1.6.0 when the disable_input_output_paths option was introduced.

@jmagman Awesome! This approach looks good to me. If we get to the point where we're seeing plugin Cocoapods that are really expensive to compile, we can deal with that as an optimisation. This solves the immediate risk in the meantime!

thanks!!!!!

thanks

If you're still seeing this error, you will need to migrate your Xcode project:

  1. File > Workspace Settings... > Build System, change dropdown to New Build System (Default)
  2. In your Podfile, add the line
install! 'cocoapods', :disable_input_output_paths => true

See https://github.com/flutter/flutter/blob/master/examples/platform_view/ios/Podfile for example.

  1. In the Runner target "[CP] Embed Pods Framework" Build Phase, remove all Output Files.

@jmagman thanks - but could this be related to #18673? Because after migrating (via flutter upgrade, which performed this change on my machine automatically in the Podfile), I can build using flutter build ios but when trying to Archive in Xcode, I run in the error of #18673.

@jmagman thanks - but could this be related to #18673? Because after migrating (via flutter upgrade, which performed this change on my machine automatically in the Podfile), I can build using flutter build ios but when trying to Archive in Xcode, I run in the error of #18673.

@jmagman I found the solution, actually this https://github.com/flutter/flutter/issues/16246#issuecomment-476329255 solved my issue. Sorry for any inconvenience.

@jmagman For those of us less familiar with XCode, could you explain step 3 further? Where is the Runner target "[CP] Embed Pods Framework" Build Phase found to remove all Output Files?

Found it. Click “Runner” in the left navigation bar, then the “Build Phases” tab, then scroll down to “Output Files”, select all of them, then click the subtract button to remove them

How can I solve this without a Mac? I use a cloud pipeline to build for iOS but need to solve this problem...

If you're still seeing this error, you will need to migrate your Xcode project:

  1. File > Workspace Settings... > Build System, change dropdown to New Build System (Default)
  2. In your Podfile, add the line
install! 'cocoapods', :disable_input_output_paths => true

See https://github.com/flutter/flutter/blob/master/examples/platform_view/ios/Podfile for example.

  1. In the Runner target "[CP] Embed Pods Framework" Build Phase, remove all Output Files.

Or you can do #1 and #2, then run pod install from the ios directory, and CocoaPods should remove that Output file in the build phase automatically.

@gincos If you don't have a Mac you can look at PR https://github.com/flutter/flutter/pull/33684/ for an example of how to tweak the Xcode files manually. If you have a Mac, please follow the above steps instead!

  1. Delete the file ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings. This is what's happening under the covers with File > Workspace Settings... > Build System > New Build System (Default).
    https://github.com/flutter/flutter/pull/33684/files#diff-e7ad834b29956b3cbd9225dc81f2c06a

    1. In your Podfile, add the line

      install! 'cocoapods', :disable_input_output_paths => true

      https://github.com/flutter/flutter/pull/33684/files#diff-4e7de62cf4dff9802f06b7f3cb120939

Hopefully your cloud pipeline should run pod install and take care of #3 above for you.

If you are still seeing the error, you can edit ios/Runner.xcodeproj/project.pbxproj to remove the output file manually. Please be careful doing this! The Xcode project file does not take kindly to corruption.
https://github.com/flutter/flutter/pull/33684/files#diff-e9e57f7f2e911a135acd8f08e79b20e1

@jmagman Thanks! This worked like a charm! Yes, the cloud provider runs pod install and now it's producing a correct artifact for both Android and iOS in the latest Beta.

Affected projects

This issue affects all Flutter projects built using Xcode 10 that have a dependency on CocoaPods -- typically this means those that rely on plugins.

Workarounds

There are two workarounds:

  • Option 1: Use the legacy build system . As noted by @gi097, open ios/Runner.xcworkspace, and change the build system to Legacy Build System.
  • Option 2: Use the new Xcode 10 build system.

    1. Open ios/Runner.xcworkspace
    2. Select the Runner project in the project navigator sidebar.
    3. In the main view, select the Runner target, then select the Build Phases tab.
    4. Expand the Embed Frameworks phase and select Flutter.framework from the embedded frameworks list.
    5. Click - to remove Flutter.framework from the list (be sure to _keep_ App.framework).

Root cause

When plugins are in use, there are two competing build actions that copy Flutter.framework into the build application Frameworks directory:

  1. The Embed Frameworks build phase for the Runner project
  2. The [CP] Embed Pods Frameworks build phase that pod install creates in the project.

Item (1) is there to ensure the framework is copied into the built app in the case where there are no plugins (and therefore no CocoaPods integration in the Xcode project). Item (2) is there because Flutter's podspec declares Flutter.framework as a vended_framework, and CocoaPods automatically adds a copy step for each such vended_framework in the transitive closure of CocoaPods dependencies.

Immediate fix

The immediate fix is for us to find a way to automatically opt back in to the legacy build fix until a longer-term better solution is in place. Previous betas supported -useNewBuildSystem=NO or -useModernBuildSystem=NO but looks like this is removed in the GM build. Looks like currently the way to do this is to add a key-value pair (<key>BuildSystemType</key><string>Original</string>) to ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings.

Longer-term fix

The simplest option would be to eliminate Flutter.framework from the Embed Frameworks step above and always rely on pod install, even in the case where there are no plugin dependencies. We'd need to update Flutter tool to automatically edit existing projects to remove Flutter.framework from the Embed Frameworks step.

pro: simpler code. con: makes cocoapods a required install step for Flutter development, first run involves a huge and very slow download of their repo.

A slightly nicer option would be for us to automatically detect whether the project uses plugins or not, and edit the Xcode project to check for and remove Flutter.framework from the Embed Frameworks step automatically if plugins are in use or add it if not.

pro: better user experience. con: more complex code.

Either way, we need some mechanism to automatically edit the project.pbxproj file and remove the framework from the embed frameworks build step. Supporting adding it back in isn't much incremental work and results in a better experience.

/cc @tvolkert @gspencergoog @dnfield

@cbracken Thanks a lot ,it works,,thanks for your help

Re-copying the real migration since it's since been buried.

If you're still seeing this error, you will need to migrate your Xcode project:

  1. File > Workspace Settings... > Build System, change dropdown to New Build System (Default)
  2. In your Podfile, add the line
install! 'cocoapods', :disable_input_output_paths => true

See https://github.com/flutter/flutter/blob/master/examples/platform_view/ios/Podfile for example.

  1. Run flutter build ios

I'm going to lock this so these migration instructions stay at the end of this issue. Please file a new issue if you have additional problems after following these instructions.

UPDATE: If you follow the migration instructions at https://flutter.dev/docs/development/ios-project-migration you can remove install! 'cocoapods', :disable_input_output_paths => true from your ios/Podfile. This may improve compilation time if you are using Flutter plugins.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

collinjackson picture collinjackson  ·  3Comments

eseidelGoogle picture eseidelGoogle  ·  3Comments

Hixie picture Hixie  ·  3Comments

aegis123 picture aegis123  ·  3Comments

drewwarren picture drewwarren  ·  3Comments