Support --flavor argument in the debugger
See original GitHub issueflutter run
accepts --flavor
for Android product flavors and Xcode schemes. If you’re using one of the aforementioned, debugging will fail with the following error (Android):
The Gradle project does not define a task suitable for the requested build.
The android/app/build.gradle file defines product flavors: <list of flavor options>
You must specify a --flavor option to select one of them.
For context, this is the flag description:
--flavor Build a custom app flavor as defined by platform-specific build setup.
Supports the use of product flavors in Android Gradle scripts.
Supports the use of custom Xcode schemes.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:3
- Comments:12 (9 by maintainers)
Top Results From Across the Web
Running Debug using Flutter Flavor? - Stack Overflow
Normally, running the app through the terminal would require me to specify it as such: flutter run --flavor private but I'm not sure...
Read more >Flavors In Flutter — Part 1
Run different flavours in different flavour mode as by inserting the following commands in the terminal of your IDEs :: ... Flavor on...
Read more >Configure build variants | Android Developers
The product flavors support the same properties as defaultConfig , because defaultConfig actually belongs to the ProductFlavor class. This means ...
Read more >Using Flutter flavors to separate the DEV and LIVE environment
We want to have two flavors called dev and live . If you want to launch a flutter app with a flavor, you...
Read more >Flavoring Flutter Applications (Android & iOS) - Medium
We need to setup custom schemes at iOS side to support multiple variants. ... flutter run -t lib/main_dev.dart --debug --flavor=dev# Run app in...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ok, I think maybe the existing
args
already supports this. I just set mylaunch.json
like this:When I hit F5, I get this in the debug console:
So, I don’t think we need to do anything here. We could add an additional
flavor
setting, but I don’t know how much value there is in it. Any opinions?I don’t have a sample project for this myself; @lukef may?
Here’s how we expose it in IntelliJ:
It’s a free-form text field; if there’s something in there, then we pass
--flavor=xxx
in via flutter run, else we don’t pass the flag. Since these are defined in gradle (or ios) files, we don’t try and to any validation of the flavor param client side.