Skip to content
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

"flutter run --flavor flavorname" fails if gradle flavor contains uppercase letter #19507

Closed
freewheelnat opened this Issue Jul 18, 2018 · 8 comments

Comments

Projects
None yet
4 participants
@freewheelnat
Copy link

freewheelnat commented Jul 18, 2018

build.gradle

 productFlavors {

        CLEnToFr {
            dimension "app"
        }
    }

flutter run --flavor clentofr and flutter run --flavor CLEnToFr both build the apk file but they then both end with error message Gradle build failed to produce an Android package. The apk is saved, as expected, in .../CLEnToFr/ folder.

If I change the gradle file to have lowercase letters only, eg "clentofr", everything works fine.

@jorgecoca

This comment has been minimized.

Copy link
Contributor

jorgecoca commented Sep 18, 2018

I am experiencing the same issue, while it works fine on iOS. Is there an ETA for this fix?

@felangel

This comment has been minimized.

Copy link

felangel commented Oct 2, 2018

Having the same issue as well

@jorgecoca

This comment has been minimized.

Copy link
Contributor

jorgecoca commented Oct 2, 2018

I believe this is preventing any Android app with flavors configured to ship, right? Or what would be the workaround?

@jorgecoca

This comment has been minimized.

Copy link
Contributor

jorgecoca commented Oct 2, 2018

In packages/flutter_tools/lib/src/android/gradle.dart we can find this:

  String _productFlavorFor(BuildInfo buildInfo) {
    if (buildInfo.flavor == null)
      return productFlavors.isEmpty ? '' : null;
    else if (productFlavors.contains(buildInfo.flavor.toLowerCase()))
      return buildInfo.flavor.toLowerCase();
    else
      return null;
  }

Could this be the problem? Would be the fix removing those toLowerCase()?

@freewheelnat

This comment has been minimized.

Copy link
Author

freewheelnat commented Oct 5, 2018

@jorgecoca It seems like it could be the issue.

It is preventing Android apps with uppercase in their flavor names to ship. So the workaround is to change the flavor name to lowercase (it works fine in that case).

@jorgecoca

This comment has been minimized.

Copy link
Contributor

jorgecoca commented Oct 5, 2018

It is a problem if you actually use flavor dimensions, since then it Gradle will expect a camel case format when composing the flavor.

@jorgecoca

This comment has been minimized.

Copy link
Contributor

jorgecoca commented Oct 5, 2018

@zoechi thoughts on the given solution? Should we go ahead and open a PR?

@zoechi

This comment has been minimized.

Copy link
Contributor

zoechi commented Oct 7, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.