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_tools] use new output location for the apk #54328

Merged
merged 3 commits into from Apr 13, 2020

Conversation

jonahwilliams
Copy link
Member

@jonahwilliams jonahwilliams commented Apr 9, 2020

Description

From #53718 , flutter.gradle will copy the output APK to a known location. Use this instead of attempting to guess the APK location.

Fixes #52905
Fixes #29509
Fixes #13977
Fixes #44796

@fluttergithubbot fluttergithubbot added the tool Affects the "flutter" command-line tool. See also t: labels. label Apr 9, 2020
@@ -35,11 +35,11 @@ Directory getApkDirectory(FlutterProject project) {
? project.android.buildDirectory
.childDirectory('host')
.childDirectory('outputs')
.childDirectory('apk')
Copy link
Member Author

Choose a reason for hiding this comment

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

This doesn't work because the flutter.gradle code added doesn't get hit in the event of a flutter module. Is this something we could fix in gradle, or do I need to keep the old APK logic around too?

Presumably since the module project is generated by us we could just change something in it to output the same as regular projects?

@blasten

Copy link

Choose a reason for hiding this comment

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

yep. The :flutter project assigned to the module isn't the root project, which is what the plugin manipulates. That can be fixed though.

@jonahwilliams
Copy link
Member Author

I updated the code to use the old location code for the module format

@@ -815,7 +823,39 @@ Iterable<File> findApkFiles(
fileExtension: '.apk',
);
}
return apks;
return apks.map((File file) => file.path);
Copy link

Choose a reason for hiding this comment

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

This function could just become:

Iterable<String> findApkFilesModule(
  FlutterProject project,
  AndroidBuildInfo androidBuildInfo,
) {
   final Iterable<String> apkFileNames = _apkFilesFor(androidBuildInfo);
   final Directory apkDirectory = getApkDirectory(project);
   return apkFileNames.map((File file) => fs.path.join(apkDirectory.path, file.path));
}

Copy link

Choose a reason for hiding this comment

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

oh nvm. This is for build apk in a module, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah

Copy link

@blasten blasten left a comment

Choose a reason for hiding this comment

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

LGTM

@Im-Kevin
Copy link
Contributor

When can this patch be updated to Stable

@jonahwilliams jonahwilliams deleted the use_new_apk_location branch April 17, 2020 17:49
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 31, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
tool Affects the "flutter" command-line tool. See also t: labels.
Projects
None yet
5 participants