-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Open
Labels
P3Issues that are less important to the Flutter projectIssues that are less important to the Flutter projecta: existing-appsIntegration with existing apps via the add-to-app flowIntegration with existing apps via the add-to-app flowd: api docsIssues with https://api.flutter.dev/Issues with https://api.flutter.dev/found in release: 3.10Found to occur in 3.10Found to occur in 3.10found in release: 3.12Found to occur in 3.12Found to occur in 3.12has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onplatform-iosiOS applications specificallyiOS applications specificallyteam-iosOwned by iOS platform teamOwned by iOS platform teamtriaged-iosTriaged by iOS platform teamTriaged by iOS platform team
Description
Option B from add to app iOS guide can't be used if app and module have a shared pod dependency.
I mentioned this issue in my feature request #114692 and it has a lot of details, but initially I didn't want to create a separate issue because I thought we had a simple workaround.
Steps to reproduce
- Integrate Flutter module into existing iOS app using Option B (or Option C) from the add2app iOS guide.
(We can use prebuilt_module from the Flutter samples as an example) - Make sure iOS app has a Cocoapods support.
(prebuilt_module: runpod initfrom theios_using_prebuilt_moduledirectory) - Add Cocoapods dependencies to the app.
(to theios_using_prebuilt_module).
# Pods for IOSUsingPrebuiltModule
pod 'Sentry', :git => 'https://github.com/getsentry/sentry-cocoa.git', :tag => '8.8.0'
pod 'DatadogSDK' => '1.19.0'
pod 'DatadogSDKCrashReporting' => '1.19.0'- Add Flutter dependencies (plugins) to the module, these plugins should have dependencies we add in the step 2 as a direct/transitive dependencies.
(add to thepubspec.yamlfrom theflutter_moduledirectory)
datadog_flutter_plugin: 1.5.1
sentry_flutter: 7.8.0- Build iOS frameworks from the Flutter module.
(runflutter build ios-framework --output=../ios_using_prebuilt_module/Flutterfrom theflutter_module) - Embed frameworks to the app following Option B from the 'add to an existing iOS app' guide.
- Open project in XCode and start app for the simulator
(to open XCode from theflutter_module:
open ../ios_using_prebuilt_module/IOSUsingPrebuiltModule.xcworkspace)
Expected results
iOS app is built and launched successfully.
Actual results
XCode build errors:
Multiple commands produce '/Users/mazhnik/Library/Developer/Xcode/DerivedData/IOSUsingPrebuiltModule-fslipirruxqfkpgbhswqnyfjfxeb/Build/Products/Debug-iphonesimulator/IOSUsingPrebuiltModule.app/Frameworks/Datadog.framework'Multiple commands produce '/Users/mazhnik/Library/Developer/Xcode/DerivedData/IOSUsingPrebuiltModule-fslipirruxqfkpgbhswqnyfjfxeb/Build/Products/Debug-iphonesimulator/IOSUsingPrebuiltModule.app/Frameworks/Sentry.framework'Warnings:
duplicate output file '/Users/mazhnik/Library/Developer/Xcode/DerivedData/IOSUsingPrebuiltModule-fslipirruxqfkpgbhswqnyfjfxeb/Build/Products/Debug-iphonesimulator/IOSUsingPrebuiltModule.app/Frameworks/Datadog.framework' on task: PhaseScriptExecution [CP] Embed Pods Frameworks /Users/mazhnik/Library/Developer/Xcode/DerivedData/IOSUsingPrebuiltModule-fslipirruxqfkpgbhswqnyfjfxeb/Build/Intermediates.noindex/IOSUsingPrebuiltModule.build/Debug-iphonesimulator/IOSUsingPrebuiltModule.build/Script-98112F522513510246BDAF44.shduplicate output file '/Users/mazhnik/Library/Developer/Xcode/DerivedData/IOSUsingPrebuiltModule-fslipirruxqfkpgbhswqnyfjfxeb/Build/Products/Debug-iphonesimulator/IOSUsingPrebuiltModule.app/Frameworks/Sentry.framework' on task: PhaseScriptExecution [CP] Embed Pods Frameworks /Users/mazhnik/Library/Developer/Xcode/DerivedData/IOSUsingPrebuiltModule-fslipirruxqfkpgbhswqnyfjfxeb/Build/Intermediates.noindex/IOSUsingPrebuiltModule.build/Debug-iphonesimulator/IOSUsingPrebuiltModule.build/Script-98112F522513510246BDAF44.shCode sample
Created a branch from the flutter/samples repository where I followed Steps to reproduce:
https://github.com/p-mazhnik/flutter-samples/tree/add2app-issue
Sample is add_to_app/prebuilt_module.
Logs
XCode Logs
Showing All Messages
Prepare packages
Prepare build
Multiple commands produce '/Users/mazhnik/Library/Developer/Xcode/DerivedData/IOSUsingPrebuiltModule-fslipirruxqfkpgbhswqnyfjfxeb/Build/Products/Debug-iphonesimulator/IOSUsingPrebuiltModule.app/Frameworks/Datadog.framework'
Multiple commands produce '/Users/mazhnik/Library/Developer/Xcode/DerivedData/IOSUsingPrebuiltModule-fslipirruxqfkpgbhswqnyfjfxeb/Build/Products/Debug-iphonesimulator/IOSUsingPrebuiltModule.app/Frameworks/Sentry.framework'
Multiple commands produce '/Users/mazhnik/Library/Developer/Xcode/DerivedData/IOSUsingPrebuiltModule-fslipirruxqfkpgbhswqnyfjfxeb/Build/Products/Debug-iphonesimulator/IOSUsingPrebuiltModule.app/Frameworks/SentryPrivate.framework'
Building targets in dependency order
Computing target dependency graph and provisioning inputs
Build target IOSUsingPrebuiltModule
duplicate output file '/Users/mazhnik/Library/Developer/Xcode/DerivedData/IOSUsingPrebuiltModule-fslipirruxqfkpgbhswqnyfjfxeb/Build/Products/Debug-iphonesimulator/IOSUsingPrebuiltModule.app/Frameworks/Datadog.framework' on task: PhaseScriptExecution [CP] Embed Pods Frameworks /Users/mazhnik/Library/Developer/Xcode/DerivedData/IOSUsingPrebuiltModule-fslipirruxqfkpgbhswqnyfjfxeb/Build/Intermediates.noindex/IOSUsingPrebuiltModule.build/Debug-iphonesimulator/IOSUsingPrebuiltModule.build/Script-98112F522513510246BDAF44.sh
duplicate output file '/Users/mazhnik/Library/Developer/Xcode/DerivedData/IOSUsingPrebuiltModule-fslipirruxqfkpgbhswqnyfjfxeb/Build/Products/Debug-iphonesimulator/IOSUsingPrebuiltModule.app/Frameworks/Sentry.framework' on task: PhaseScriptExecution [CP] Embed Pods Frameworks /Users/mazhnik/Library/Developer/Xcode/DerivedData/IOSUsingPrebuiltModule-fslipirruxqfkpgbhswqnyfjfxeb/Build/Intermediates.noindex/IOSUsingPrebuiltModule.build/Debug-iphonesimulator/IOSUsingPrebuiltModule.build/Script-98112F522513510246BDAF44.sh
duplicate output file '/Users/mazhnik/Library/Developer/Xcode/DerivedData/IOSUsingPrebuiltModule-fslipirruxqfkpgbhswqnyfjfxeb/Build/Products/Debug-iphonesimulator/IOSUsingPrebuiltModule.app/Frameworks/SentryPrivate.framework' on task: PhaseScriptExecution [CP] Embed Pods Frameworks /Users/mazhnik/Library/Developer/Xcode/DerivedData/IOSUsingPrebuiltModule-fslipirruxqfkpgbhswqnyfjfxeb/Build/Intermediates.noindex/IOSUsingPrebuiltModule.build/Debug-iphonesimulator/IOSUsingPrebuiltModule.build/Script-98112F522513510246BDAF44.sh
Activity Log Complete 09.07.2023, 10:05 0.2 seconds
Flutter Doctor output
Doctor output
[✓] Flutter (Channel stable, 3.10.5, on macOS 13.3.1 22E772610a darwin-arm64,
locale ru-RU)
• Flutter version 3.10.5 on channel stable at /Users/mazhnik/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 796c8ef792 (4 weeks ago), 2023-06-13 15:51:02 -0700
• Engine revision 45f6e00911
• Dart version 3.0.5
• DevTools version 2.23.1
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
• Android SDK at /Users/mazhnik/Library/Android/sdk
• Platform android-33, build-tools 33.0.1
• ANDROID_HOME = /Users/mazhnik/Library/Android/sdk
• Java binary at: /Users/mazhnik/Library/Application
Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/222.4459.24.2221.9971841
/Android Studio.app/Contents/jbr/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build
17.0.6+0-17.0.6b802.4-9586694)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 14.3.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 14E300c
• CocoaPods version 1.12.1
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2022.2)
• Android Studio at /Users/mazhnik/Library/Application
Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/222.4459.24.2221.9971841
/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build
17.0.6+0-17.0.6b802.4-9586694)
[✓] IntelliJ IDEA Ultimate Edition (version 2023.1.3)
• IntelliJ at /Users/mazhnik/Applications/JetBrains Toolbox/IntelliJ IDEA
Ultimate.app
• Flutter plugin version 74.0.4
• Dart plugin version 231.9161.14
[✓] IntelliJ IDEA Ultimate Edition (version 2023.1.3)
• IntelliJ at /Users/mazhnik/Library/Application
Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/231.9161.38/IntelliJ IDEA.app
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
[✓] VS Code (version 1.73.0)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.52.0
[✓] Connected device (3 available)
• iPhone 14 Pro (mobile) • BB40A04B-5DC2-4B69-864F-8B42B652A2B5 • ios
• com.apple.CoreSimulator.SimRuntime.iOS-16-4 (simulator)
• macOS (desktop) • macos •
darwin-arm64 • macOS 13.3.1 22E772610a darwin-arm64
• Chrome (web) • chrome •
web-javascript • Google Chrome 114.0.5735.198
[✓] Network resources
• All expected network resources are available.
• No issues found!Proposal
- Update flutter add-to-app documentation to indicate that Options B & Option C have limitation in case flutter plugin and native iOS app have a shared dependency.
- Introduce new flag
--[no-]-pluginsfor thebuild ios-frameworkcommand that excludes plugins from build (_producePluginsfunction is not called):
[Add2App] provide flag for 'build ios-framework' command to build only App.xcframework #114692 - Introduce Option D that suggests developers to:
- build frameworks using
flutter build ios-framework --no-plugins - link & embed
App.xcframeworkusing option B - link & embed
Flutter.xcframeworkusing option B or C - link plugins to project by adding them to
Podfiledirectly (e.g. by usinginstall_flutter_plugin_pods, similar to Option A). Another advantage -- we don't need to determine whether plugin produce static or dynamic framework (like in option B when embed plugins frameworks manually), Cocoapods will do this for us.- If using
install_flutter_plugin_podswe will run into a limitation:
it requires Flutter and module dependencies to be installed locally. Workaround is to copy plugins somewhere and add them to project manually or using script similar toflutter_install_plugin_pods. I am not sure if we should provide such scripts to the developers. - we may also need a slightly different version of
flutter_post_installscript
- If using
- build frameworks using
AriasBros and Youcef-Goudjal
Metadata
Metadata
Assignees
Labels
P3Issues that are less important to the Flutter projectIssues that are less important to the Flutter projecta: existing-appsIntegration with existing apps via the add-to-app flowIntegration with existing apps via the add-to-app flowd: api docsIssues with https://api.flutter.dev/Issues with https://api.flutter.dev/found in release: 3.10Found to occur in 3.10Found to occur in 3.10found in release: 3.12Found to occur in 3.12Found to occur in 3.12has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onplatform-iosiOS applications specificallyiOS applications specificallyteam-iosOwned by iOS platform teamOwned by iOS platform teamtriaged-iosTriaged by iOS platform teamTriaged by iOS platform team