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
[flutter_tools] use new output location for the apk #54328
Conversation
@@ -35,11 +35,11 @@ Directory getApkDirectory(FlutterProject project) { | |||
? project.android.buildDirectory | |||
.childDirectory('host') | |||
.childDirectory('outputs') | |||
.childDirectory('apk') |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
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); |
There was a problem hiding this comment.
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));
}
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This reverts commit 9cb9bfb.
When can this patch be updated to Stable |
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