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

Teach the flutter tool how to find android output files if the flavor contains uppercase letters #66687

Merged
merged 5 commits into from Sep 25, 2020

Conversation

knaeckeKami
Copy link
Contributor

Description

This changes the name of the generated output files on android in case a flavor with uppercase letters is used.
Previously, the lowercased flavor name would be used for the apk/aab file. Now, the flavor name is used as-is.

Example: when adding a flavor with the name "aB" to the flutter template project, the name of the generated .aab file is now

app-aB-release.aab instead of
app-ab-release.aab

Because of calling .toLowerCase() on the flavor name, the generated apk/aab files would not be found after the Gradle build for users that use a case sensitive file system (typically Linux, but not Windows or Mac OS), and they would get an error message

Gradle build failed to produce a .apk file. It's likely that this file was generated under /builds/<...>/build, but the tool couldn't find it.

because the flutter tool looks for a file with the real flavor name in its name, not the lowercased flavor name.
See https://github.com/flutter/flutter/blob/master/packages/flutter_tools/lib/src/android/gradle.dart#L900

Related Issues

fixes #24106 , particularly #24106 (comment)

Tests

I did not add tests. Since this is a change in the gradle file for the android build process, I don't know how I would add a test for this. If tests are required, I would appreciate a pointer on how and where to add them.

Checklist

Before you create this PR, confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]). This will ensure a smooth and quick review process.

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I signed the [CLA].
  • I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement].
  • I read the [Tree Hygiene] wiki page, which explains my responsibilities.
  • I updated/added relevant documentation (doc comments with ///).
  • All existing and new tests are passing.
  • The analyzer (flutter analyze --flutter-repo) does not report any problems on my PR.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Did any tests fail when you ran them? Please read [Handling breaking changes].

This should not be a breaking change.
If one does not use uppercase letters in flavor names, nothing changes.

Otherwise, for Windows and Mac, this name of the generated file apk will be different, however, since the file systems of these operating systems are not case sensitive, this should not cause problems.
On Linux, this should also not be a breaking change, since using a flavor name with uppercase letters caused the build to fail anyway previously.

Alternatives

If using upper case letters in the output files is not desired, we could also fix the expected file names in
https://github.com/flutter/flutter/blob/master/packages/flutter_tools/lib/src/android/gradle.dart to use the lower case flavor names.

see #65768

@flutter-dashboard flutter-dashboard bot added the tool Affects the "flutter" command-line tool. See also t: labels. label Sep 25, 2020
Copy link
Member

@jonahwilliams jonahwilliams left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@knaeckeKami
Copy link
Contributor Author

Hm, do you have an idea why deploy_gallery-macos still fails?

@jonahwilliams
Copy link
Member

flaky test, I restarted it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tool Affects the "flutter" command-line tool. See also t: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

On Linux, problems building an Android app that uses flavor dimensions with uppercase characters
3 participants