Skip to content

On Linux, problems building an Android app that uses flavor dimensions with uppercase characters #24106

@jorgecoca

Description

@jorgecoca

Happening on latest beta ([✓] Flutter (Channel master, v0.10.3-pre.145, on Mac OS X 10.13.6 17G3025, locale en-US))

I have a Flutter app that uses the following flavor dimensions scheme (Gradle):

flavorDimensions "brand", "region"
    productFlavors {
        BRAND1 {
            dimension "brand"
            applicationIdSuffix ".brand1"
        }
        BRAND2 {
            dimension "brand"
            applicationIdSuffix ".brand2"
        }
        northAmerica {
            dimension "region"
            applicationIdSuffix ".northamerica"
        }
        spain {
            dimension "region"
            applicationIdSuffix ".spain"
        }
    }

When running the app, this is the run command that I use:

flutter run -t lib/main/main_brand1_north_america_debug.dart --flavor BRAND1NorthAmerica

While this works perfectly on iOS, on Android I get the following error:

➜  git:(master) flutter run -t lib/main/main_brand1_north_america_debug.dart --flavor BRAND1NorthAmerica
Using hardware rendering with device Android SDK built for x86. If you get graphics artifacts, consider enabling software rendering with "--enable-software-rendering".
Launching lib/main/main_brand1_north_america_debug.dart on Android SDK built for x86 in debug mode...
Initializing gradle...                                       0.8s
Resolving dependencies...                                    2.4s

The Gradle project does not define a task suitable for the requested build.
The android/app/build.gradle file defines product flavors: brand1, brand1spain, brand1northamerica, brand2, brand2spain, brand2northamerica
You must specify a --flavor option to select one of them.
Gradle build aborted.

As you can see, there's a problem where the product flavors are lowercased, but those do not match the gradle tasks available.

If I follow the recommendation of the error message and try to lowercase the flavor, it still fails:

➜  mobile_connected git:(master) flutter run -t lib/main/main_brand1_north_america_debug.dart --flavor brand1northamerica
Using hardware rendering with device Android SDK built for x86. If you get graphics artifacts, consider enabling software rendering with "--enable-software-rendering".
Launching lib/main/main_brand1_north_america_debug.dart on Android SDK built for x86 in debug mode...
Initializing gradle...                                       0.8s
Resolving dependencies...                                    2.1s
Gradle task 'assembleBrand1northamericaDebug'...
Gradle task 'assembleBrand1northamericaDebug'... Done          3.7s
Gradle build failed to produce an Android package.

And it is because that gradle task does not exist.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listc: crashStack traces logged to the consolet: gradle"flutter build" and "flutter run" on AndroidtoolAffects the "flutter" command-line tool. See also t: labels.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions