Changing bundle id on flutter ios app for debug, staging, release builds

2,483 views
Skip to first unread message

Jason Scott

unread,
Aug 7, 2018, 3:05:50 AM8/7/18
to Flutter Dev
I'd like to be able to have a different bundle id for my debug, staging and release builds. This is quite easy to setup in Xcode and I can use a new Scheme for each (see examples in this blog post https://medium.com/@danielgalasko/run-multiple-versions-of-your-app-on-the-same-device-using-xcode-configurations-1fd3a220c608).

But I can never get it to play well with flutter. When I select the Scheme for "staging" for example and then Archive I get all sort so of build errors. Prior to doing this I need to `run flutter build ios` but it uses the release scheme by the looks of its.

Its all very confusing so am wondering if anyone has a clear and concise guide on how to do this with flutter..?

Mikkel Ravn

unread,
Aug 7, 2018, 3:11:13 AM8/7/18
to ja...@jaylin.com.au, Flutter Dev
Flutter CLI tools 'run' and 'build' take a '--flavor' argument that maps to schemes on iOS.

--
You received this message because you are subscribed to the Google Groups "Flutter Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Mikkel Nygaard Ravn
Software Engineer

Jason Scott

unread,
Aug 7, 2018, 3:13:24 AM8/7/18
to Mikkel Ravn, Flutter Dev
So `flutter build ios --flavor "MyScheme" ' will work? Trying now...  ;-)
Then after running that I can perform an Archive in Xcode - is that the normal process?

Mikkel Ravn

unread,
Aug 7, 2018, 3:13:55 AM8/7/18
to ja...@jaylin.com.au, Flutter Dev
... though the build flavor does not change the fact that Flutter tooling expects you to have debug, profile, release builds. They do add a second dimension though, as in a "free" vs "paid" flavor of your app.

Mikkel Ravn

unread,
Aug 7, 2018, 3:16:31 AM8/7/18
to ja...@jaylin.com.au, Flutter Dev
The intention of build flavors is documented here: https://github.com/flutter/flutter/pull/11734

Jason Scott

unread,
Aug 7, 2018, 3:19:23 AM8/7/18
to Mikkel Ravn, Flutter Dev
I just managed to get the app archive to work even though I just ran `flutter build io` (which is a release build). Lots of magic here.  ;-)
@Mikkel - thanks for the link - trying to digest it now.


Jason Scott

unread,
Aug 7, 2018, 3:38:56 AM8/7/18
to Mikkel Ravn, Flutter Dev
It seems to break when I switch back to the normal Runner Scheme. Back in the flutter dev tools I get this error when trying to run the app: 

Launching lib/main.dart on iPhone X in debug mode...
Running pod install...
Starting Xcode build...
Xcode build done.
Failed to build iOS app
Error output from Xcode build:
    2018-08-07 15:35:42.541 xcodebuild[87043:1128532]  DTDeviceKit: deviceType from c2c5624b192bebadf174e3a5de8e32c061f0543b was NULL
    ** BUILD FAILED **
    
Xcode's output:
    /Users/g076842/Documents/dev/notifications/ios/Pods/FirebaseFirestore/Firestore/Source/Core/FSTTransaction.mm:24:9: fatal error: 'FIRFirestoreErrors.h' file not found
    #import "FIRFirestoreErrors.h"
            ^~~~~~~~~~~~~~~~~~~~~~
    1 error generated.
Could not build the application for the simulator.
Error launching application on iPhone X.

Jason Scott

unread,
Aug 7, 2018, 3:58:32 AM8/7/18
to Mikkel Ravn, Flutter Dev
Seems that those two errors above was just to restart the ios sim. Not sure why it gets it knickers into a knot after having previously changed xcode scheme's....

Jason Scott

unread,
Aug 7, 2018, 5:39:01 AM8/7/18
to Flutter Dev
Following this issue it looks like what I am trying to do (different bundle id's for different Schemes) is not supported by flutter...

https://github.com/flutter/flutter/issues/15567

That seems to be a big issue for using Flutter in real-life situations. Any ways around this?

Ralph Bergmann

unread,
Aug 7, 2018, 6:13:52 AM8/7/18
to Jason Scott, Flutter Dev
I think you have two options to do that:

1st with Xcode configurations. Flutter select the configuration with the
--flavor flag
2nd if you don't want to use configurations you can build your project
with Fastlane gym where you can specify which Scheme you want to build


Ralph


Am 07.08.18 um 11:39 schrieb Jason Scott:

Ralph Bergmann

unread,
Aug 7, 2018, 6:15:59 AM8/7/18
to Jason Scott, Flutter Dev
more about option 1:
https://medium.com/@salvatoregiordanoo/flavoring-flutter-392aaa875f36

Am 07.08.18 um 12:13 schrieb Ralph Bergmann:

Jason Scott

unread,
Aug 7, 2018, 7:21:11 AM8/7/18
to Ralph Bergmann, Flutter Dev
Thanks for that info Ralph. I still can’t see how you can change the bundle id’s but I need to read this about ten times for it to start sinking in. ;-)

Jason Scott

unread,
Aug 7, 2018, 7:28:22 AM8/7/18
to Ralph Bergmann, Flutter Dev
Maybe you’re supposed to keep the same bundle id but just change the icon etc like in that blog post.

Ralph Bergmann

unread,
Aug 7, 2018, 8:59:19 AM8/7/18
to Jason Scott, Flutter Dev
I created a new configuration (duplicate a existing one) and named it
"foo". Then select the target -> Build Settings -> Product Bundle
Identifier and change what ever youe need.


Ralph


Am 07.08.18 um 13:20 schrieb Jason Scott:
> --
> You received this message because you are subscribed to the Google
> Groups "Flutter Dev" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to flutter-dev...@googlegroups.com
> <mailto:flutter-dev...@googlegroups.com>.
Verfassen: Re: Changing bundle id on flutter ios app for debug, staging, release builds 2018-08-07 14-57-54.png

Jason Scott

unread,
Aug 7, 2018, 9:09:33 AM8/7/18
to Ralph Bergmann, Flutter Dev
If you do that then try and go back to normal flutter development the flutter tooling gets confused about the multiple bundle id’s. There’s an outstanding issue about it I linked earlier.

Jason Scott

unread,
Aug 8, 2018, 2:47:56 AM8/8/18
to Flutter Dev
I followed the blog post on using flutter flavors but `flutter buid ios --flavor <flavor>` causes heaps of xcode build errors such as:

Unable to find the Gerenated.xcconfig include, and

diff: /Podfile.lock: No such file or directory
diff: /Manifest.lock: No such file or directory
error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation

Running pod install as the error mention doesn't fix things.

Seems that there's other config that needs to be done to get flutter build to work with flavors on ios which is mentioned in the blog post.

Reply all
Reply to author
Forward
0 new messages