-
Notifications
You must be signed in to change notification settings - Fork 27k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Add2App] option B from iOS guide can't be used if app and module have a shared pod dependency #130220
Comments
Simple workaround that worked for me for some plugins: For the sample code above, it means that we need to remove some frameworks from the I believe this can't be a DataDogSdk issue, because all is working as expected using Option A. Probably it has smth to do with the fact that |
Complex workaround that involves combination of Options A and B and custom scripts, can be found here: |
Thanks for the detailed report. I was able to replicate the reported behavior using the code sample and steps to replicate provided. stable, master flutter doctor -v
|
Some update about this issue? |
…orks from the build (#129739) A lot of details are written in the feature request: #114692. tl;dr: Options B & C from the add2app iOS guide have a limitation (build error) in case the Flutter plugin and native iOS app have a shared dependency. We can use a workaround to avoid the issue, but in this case we don't need to build frameworks for plugins. Closes #114692 Part of #130220
I also encountered this issue. I see that Also, is there a way to define a custom Pod dependency only for a given flutter plugin?
But is there a way to define it only for a specific flutter plugin? |
Hello @nasko25, My solution was: App and Flutter
For example the app.podspec:
So in the podfile you can just add this podspec.
Plugins Whene you do the Basically you can add the FlutterPluginRegistrant pod in your podfile and use a private cocoapods repo (Ex. Jfrog Artifactory) with the pods. Maybe you can use git too. For example, my app has geolocator and maps. So the ios plugins in the FlutterPluginRegistrant I uploaded all to Jfrog. In my case I use the Jfrog and works fine. Example: Podfile
|
Hey @4rthurmonteiro Thank you for sharing your solution. |
@4rthurmonteiro have you written about how you did it?
|
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
(We can use prebuilt_module from the Flutter samples as an example)
(
prebuilt_module
: runpod init
from theios_using_prebuilt_module
directory)(to the
ios_using_prebuilt_module
).(add to the
pubspec.yaml
from theflutter_module
directory)(run
flutter build ios-framework --output=../ios_using_prebuilt_module/Flutter
from theflutter_module
)(to open XCode from the
flutter_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.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
Code sample
Created a branch from the
flutter/samples
repository where I followedSteps to reproduce
:https://github.com/p-mazhnik/flutter-samples/tree/add2app-issue
Sample is
add_to_app/prebuilt_module
.Logs
XCode Logs
Flutter Doctor output
Doctor output
Proposal
--[no-]-plugins
for thebuild ios-framework
command that excludes plugins from build (_producePlugins
function is not called):[Add2App] provide flag for 'build ios-framework' command to build only App.xcframework #114692
flutter build ios-framework --no-plugins
App.xcframework
using option BFlutter.xcframework
using option B or CPodfile
directly (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.install_flutter_plugin_pods
we 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 to
flutter_install_plugin_pods
. I am not sure if we should provide such scripts to the developers.flutter_post_install
scriptThe text was updated successfully, but these errors were encountered: