[tool][android] Allow --target-platform work properly with --debug mode (#154476)

This PR addresses an issue where the `--target-platform` flag was not being respected when building APKs in debug mode. Previously, debug builds would always include `x86` and `x64` architectures, regardless of the specified target platform. This change ensures that the `--target-platform` flag is honored across all build modes, including debug.

To achieve this, `BuildApkCommand` has been slightly changed to become responsible for list of archs that should be built in the current run,rather than just parsing arguments. Previously, this responsibility was distributed to gradle, which could be frustrating (in my opinion)

Fixes #153359
This commit is contained in:
Mikhail Novoseltsev
2024-10-01 20:24:53 +05:00
committed by GitHub
parent 6bba08cbcc
commit 0975e612c0
5 changed files with 190 additions and 48 deletions

View File

@@ -228,7 +228,6 @@ Future<void> main() async {
checkFileContains(<String>[
'flutter_embedding_debug',
'x86_debug',
'x86_64_debug',
'armeabi_v7a_debug',
'arm64_v8a_debug',

View File

@@ -34,9 +34,6 @@ Future<void> main() async {
...debugAssets,
...baseApkFiles,
'lib/armeabi-v7a/libflutter.so',
// Debug mode intentionally includes `x86` and `x86_64`.
'lib/x86/libflutter.so',
'lib/x86_64/libflutter.so',
], apkFiles);
checkCollectionDoesNotContain<String>(<String>[
@@ -65,9 +62,7 @@ Future<void> main() async {
...flutterAssets,
...debugAssets,
...baseApkFiles,
// Debug mode intentionally includes `x86` and `x86_64`.
'lib/x86/libflutter.so',
'lib/x86_64/libflutter.so',
], apkFiles);
checkCollectionDoesNotContain<String>(<String>[
@@ -96,8 +91,6 @@ Future<void> main() async {
...flutterAssets,
...debugAssets,
...baseApkFiles,
// Debug mode intentionally includes `x86` and `x86_64`.
'lib/x86/libflutter.so',
'lib/x86_64/libflutter.so',
], apkFiles);