-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Add documentation for supporting flavors #4321
Comments
Also include instructions for different signing details per flavor, see flutter/flutter#46879. |
We'd love better docs! Unfortunately it's not a high priority for Q2. |
@jmagman that example in the flutter integration tests is the best I've found, after a lot of time spent trying various documentation, blog articles, code examples, etc. I tried to copy that ios directory into my own project hoping to get it to work, but it didn't. Could you please add notes somewhere to reconstruct the example in the flavors integration test? EDIT: My initial goal is just two distinct iOS bundle ids to encourage my usage of recent changes to a dogfood app, keeping a stable version installed on personal device, in parallel to the beta install. EDIT EDIT: Copying over from the flutter/flutter flavors integration test has to work somehow, I'll just keep trying that. |
That's what this issue is tracking: documenting that somewhere.
You can set different bundle identifiers per build configuration in Xcode: That's not a Flutter thing, it's an Xcode thing. If you look up how to set different build settings by build configuration you'll have better luck. I just haven't had time to write this doc... |
Here's what seemed to work for me:
And everything seems to work now. I still have to smooth everything out, and hope that this all works with the rest of deployment process. This seemed like a smaller perceived effort than my previous attempts. Apologies if this is not the correct repo and issue, but it seemed like a close fit since for me, this app example seems to be the closest fit to solve the issue. There's an issue to add documentation, and I saw what looked like a working example, so I imagined simply sketching notes on the origins of that example would solve. Copying the ios directory is unfortunately not the same as, "here's how we created that example". The Podfile is modified with targets, there is a MethodChannel and AppDelegate, etc. I think a drawback of the approach I'm taking, is there isn't a profiling configuration, and I may be using some stale |
I wasn't satisfied with making small edits to the current state of the integration-test-as-example. I used I've managed to create a repo that starts from recent I'll next work on a few more steps for the relevant commits on or after May 11, 2020, and hopefully be able to share it as a repo. Potentially someone can use that repo to assist in writing up documentation for the website. |
I've created a repo at https://github.com/bradyt/flutter-flavor-reproduce-steps/, and pushed at tag I'm having a little trouble with the next steps. I think I need to rename and duplicate the Target "Runner" to "Free App" and "Paid App", but I'm not sure how to end up with Info.plist being replaced with Info-Free.plist and Info-Paid.plist using the Xcode GUI. |
I think I got it, I right click in the navigation pane to add a file, select Property List, click on files to rename, and use "open as source code" to copy the text between them. |
There's probably not a good reason to do that in your case, you're just trying to have different bundle identifiers, right? You would just set that in the build settings The Info.plist will just reference that build setting as Anyway this issue is tracking making better docs. If I recall https://medium.com/@animeshjain/build-flavors-in-flutter-android-and-ios-with-different-firebase-projects-per-flavor-27c5c5dac10b was a pretty good start. |
I've had difficulty with every approach linked from the website. I'm guessing those blog articles are easier to follow if you already know what to do. Perhaps I was a little fixated to follow the integration test as an example, but it seemed to work and had at least a little bit of a git history to follow. I think I was able to reproduce the steps in your May 11 2020 commit and document that, at the repo I mentioned above, and a second tag The output is very close to what is found in the flavors integration test. For me, the notes I've written are documentation that work from I'm sure they're not as polished as what you might prefer to post on Flutter website, but maybe their completeness will help someone create another writeup. If I can clarify anything in my writeup, please don't hesitate to ask. It was a fast sketch. |
Thanks for your write-up, and sorry our docs aren't great for flavors, it's on the list of things to improve... |
https://flutter.dev/docs/deployment/flavors currently links to some community articles, but it would be better if there were official documentation.
For example, flutter/flutter#56507 is due to confusion about flavors and build configurations in Xcode. However there's no place to update and emphasize the correct fix for this issue, or even any documentation to link to. There have been some attempts to make flavors easier to use in iOS and those community articles can get out of date. There's a lot of bad advice on Stack Overflow that get people in a corrupted state.
The text was updated successfully, but these errors were encountered: