Add a flutter run option that can override the default target platform (#14537)
By default flutter run will build a 64-bit APK if the attached Android device is 64-bit. Specifying --target-platform=android-arm will deploy a 32-bit APK to a 64-bit device. Fixes https://github.com/flutter/flutter/issues/14526
This commit is contained in:
parent
7db0564ab6
commit
3c9ad811f7
@ -367,7 +367,7 @@ class AndroidDevice extends Device {
|
|||||||
}
|
}
|
||||||
|
|
||||||
BuildInfo buildInfo = debuggingOptions.buildInfo;
|
BuildInfo buildInfo = debuggingOptions.buildInfo;
|
||||||
if (devicePlatform == TargetPlatform.android_arm64)
|
if (buildInfo.targetPlatform == null && devicePlatform == TargetPlatform.android_arm64)
|
||||||
buildInfo = buildInfo.withTargetPlatform(TargetPlatform.android_arm64);
|
buildInfo = buildInfo.withTargetPlatform(TargetPlatform.android_arm64);
|
||||||
|
|
||||||
if (!prebuiltApplication) {
|
if (!prebuiltApplication) {
|
||||||
|
@ -34,6 +34,11 @@ abstract class RunCommandBase extends FlutterCommand {
|
|||||||
'forwards the host port to a device port.');
|
'forwards the host port to a device port.');
|
||||||
argParser.addOption('route',
|
argParser.addOption('route',
|
||||||
help: 'Which route to load when running the app.');
|
help: 'Which route to load when running the app.');
|
||||||
|
argParser.addOption('target-platform',
|
||||||
|
defaultsTo: 'default',
|
||||||
|
allowed: <String>['default', 'android-arm', 'android-arm64'],
|
||||||
|
help: 'Specify the target platform when building the app for an '
|
||||||
|
'Android device.\nIgnored on iOS.');
|
||||||
usesTargetOption();
|
usesTargetOption();
|
||||||
usesPortOptions();
|
usesPortOptions();
|
||||||
usesPubOption();
|
usesPubOption();
|
||||||
|
@ -164,6 +164,12 @@ abstract class FlutterCommand extends Command<Null> {
|
|||||||
? argResults['preview-dart-2']
|
? argResults['preview-dart-2']
|
||||||
: false;
|
: false;
|
||||||
|
|
||||||
|
TargetPlatform targetPlatform;
|
||||||
|
if (argParser.options.containsKey('target-platform') &&
|
||||||
|
argResults['target-platform'] != 'default') {
|
||||||
|
targetPlatform = getTargetPlatformForName(argResults['target-platform']);
|
||||||
|
}
|
||||||
|
|
||||||
return new BuildInfo(getBuildMode(),
|
return new BuildInfo(getBuildMode(),
|
||||||
argParser.options.containsKey('flavor')
|
argParser.options.containsKey('flavor')
|
||||||
? argResults['flavor']
|
? argResults['flavor']
|
||||||
@ -178,9 +184,7 @@ abstract class FlutterCommand extends Command<Null> {
|
|||||||
preferSharedLibrary: argParser.options.containsKey('prefer-shared-library')
|
preferSharedLibrary: argParser.options.containsKey('prefer-shared-library')
|
||||||
? argResults['prefer-shared-library']
|
? argResults['prefer-shared-library']
|
||||||
: false,
|
: false,
|
||||||
targetPlatform: argParser.options.containsKey('target-platform')
|
targetPlatform: targetPlatform);
|
||||||
? getTargetPlatformForName(argResults['target-platform'])
|
|
||||||
: null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void setupApplicationPackages() {
|
void setupApplicationPackages() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user