question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support --flavor argument in the debugger

See original GitHub issue

flutter 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:closed
  • Created 6 years ago
  • Reactions:3
  • Comments:12 (9 by maintainers)

github_iconTop GitHub Comments

18reactions
DanTupcommented, Feb 12, 2018

Ok, I think maybe the existing args already supports this. I just set my launch.json like this:

{
	"name": "Flutter",
	"request": "launch",
	"type": "flutter",
	"args": [
		"--flavor",
		"red"
	]
}

When I hit F5, I get this in the debug console:

The Gradle project does not define a task suitable for the requested build.
The android/app/build.gradle file does not define any custom product flavors.
You cannot use the --flavor option.

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?

3reactions
devoncarewcommented, Feb 8, 2018

I don’t have a sample project for this myself; @lukef may?

Here’s how we expose it in IntelliJ:

screen shot 2018-02-08 at 7 33 32 am

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found