Replace ANDROID_HOME user messages with ANDROID_SDK_ROOT (#59867)
This commit is contained in:
parent
9470b9e2ce
commit
6a2bc2617e
@ -1113,7 +1113,7 @@ Map<String, String> _initGradleEnvironment() {
|
||||
? Platform.environment['ANDROID_SDK_ROOT']
|
||||
: Platform.environment['ANDROID_HOME'];
|
||||
if (androidSdkRoot == null || androidSdkRoot.isEmpty) {
|
||||
print('${red}Could not find Android SDK; set ANDROID_SDK_ROOT (or ANDROID_HOME).$reset');
|
||||
print('${red}Could not find Android SDK; set ANDROID_SDK_ROOT.$reset');
|
||||
exit(1);
|
||||
}
|
||||
return <String, String>{
|
||||
|
@ -94,7 +94,7 @@ reproduce a CI test failure locally.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
You must set the `ANDROID_HOME` or `ANDROID_SDK_ROOT` environment variable to run
|
||||
You must set `ANDROID_SDK_ROOT` environment variable to run
|
||||
tests on Android. If you have a local build of the Flutter engine, then you have
|
||||
a copy of the Android SDK at `.../engine/src/third_party/android_tools/sdk`.
|
||||
|
||||
|
@ -690,8 +690,8 @@ String get adbPath {
|
||||
|
||||
if (androidHome == null) {
|
||||
throw const DeviceException(
|
||||
'The ANDROID_SDK_ROOT and ANDROID_HOME environment variables are '
|
||||
'missing. At least one of these variables must point to the Android '
|
||||
'The ANDROID_SDK_ROOT environment variable is '
|
||||
'missing. The variable must point to the Android '
|
||||
'SDK directory containing platform-tools.'
|
||||
);
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ String get _androidHome {
|
||||
final String androidHome = Platform.environment['ANDROID_HOME'] ??
|
||||
Platform.environment['ANDROID_SDK_ROOT'];
|
||||
if (androidHome == null || androidHome.isEmpty) {
|
||||
throw Exception('Unset env flag: `ANDROID_HOME` or `ANDROID_SDK_ROOT`.');
|
||||
throw Exception('Environment variable `ANDROID_SDK_ROOT` is not set.');
|
||||
}
|
||||
return androidHome;
|
||||
}
|
||||
|
@ -59,10 +59,10 @@ class AndroidDevices extends PollingDeviceDiscovery {
|
||||
)).stdout.trim();
|
||||
} on ArgumentError catch (exception) {
|
||||
throwToolExit('Unable to find "adb", check your Android SDK installation and '
|
||||
'ANDROID_HOME environment variable: ${exception.message}');
|
||||
'$kAndroidSdkRoot environment variable: ${exception.message}');
|
||||
} on ProcessException catch (exception) {
|
||||
throwToolExit('Unable to run "adb", check your Android SDK installation and '
|
||||
'ANDROID_HOME environment variable: ${exception.executable}');
|
||||
'$kAndroidSdkRoot environment variable: ${exception.executable}');
|
||||
}
|
||||
final List<AndroidDevice> devices = <AndroidDevice>[];
|
||||
parseADBDeviceOutput(
|
||||
|
@ -14,22 +14,24 @@ import '../convert.dart';
|
||||
import '../globals.dart' as globals;
|
||||
import 'android_studio.dart';
|
||||
|
||||
// ANDROID_HOME is deprecated.
|
||||
// See https://developer.android.com/studio/command-line/variables.html#envar
|
||||
const String kAndroidHome = 'ANDROID_HOME';
|
||||
const String kAndroidSdkRoot = 'ANDROID_SDK_ROOT';
|
||||
|
||||
// Android SDK layout:
|
||||
|
||||
// $ANDROID_HOME/platform-tools/adb
|
||||
// $ANDROID_SDK_ROOT/platform-tools/adb
|
||||
|
||||
// $ANDROID_HOME/build-tools/19.1.0/aapt, dx, zipalign
|
||||
// $ANDROID_HOME/build-tools/22.0.1/aapt
|
||||
// $ANDROID_HOME/build-tools/23.0.2/aapt
|
||||
// $ANDROID_HOME/build-tools/24.0.0-preview/aapt
|
||||
// $ANDROID_HOME/build-tools/25.0.2/apksigner
|
||||
// $ANDROID_SDK_ROOT/build-tools/19.1.0/aapt, dx, zipalign
|
||||
// $ANDROID_SDK_ROOT/build-tools/22.0.1/aapt
|
||||
// $ANDROID_SDK_ROOT/build-tools/23.0.2/aapt
|
||||
// $ANDROID_SDK_ROOT/build-tools/24.0.0-preview/aapt
|
||||
// $ANDROID_SDK_ROOT/build-tools/25.0.2/apksigner
|
||||
|
||||
// $ANDROID_HOME/platforms/android-22/android.jar
|
||||
// $ANDROID_HOME/platforms/android-23/android.jar
|
||||
// $ANDROID_HOME/platforms/android-N/android.jar
|
||||
// $ANDROID_SDK_ROOT/platforms/android-22/android.jar
|
||||
// $ANDROID_SDK_ROOT/platforms/android-23/android.jar
|
||||
// $ANDROID_SDK_ROOT/platforms/android-N/android.jar
|
||||
|
||||
final RegExp _numberedAndroidPlatformRe = RegExp(r'^android-([0-9]+)$');
|
||||
final RegExp _sdkVersionRe = RegExp(r'^ro.build.version.sdk=([0-9]+)$');
|
||||
|
@ -304,6 +304,6 @@ void exitWithNoSdkMessage() {
|
||||
BuildEvent('unsupported-project', eventError: 'android-sdk-not-found', flutterUsage: globals.flutterUsage).send();
|
||||
throwToolExit(
|
||||
'$warningMark No Android SDK found. '
|
||||
'Try setting the ANDROID_HOME environment variable.'
|
||||
'Try setting the ANDROID_SDK_ROOT environment variable.'
|
||||
);
|
||||
}
|
||||
|
@ -266,7 +266,7 @@ void main() {
|
||||
arguments: <String>['--no-pub'],
|
||||
);
|
||||
}, throwsToolExit(
|
||||
message: 'No Android SDK found. Try setting the ANDROID_HOME environment variable',
|
||||
message: 'No Android SDK found. Try setting the ANDROID_SDK_ROOT environment variable',
|
||||
));
|
||||
},
|
||||
overrides: <Type, Generator>{
|
||||
|
@ -212,7 +212,7 @@ void main() {
|
||||
arguments: <String>['--no-pub'],
|
||||
);
|
||||
}, throwsToolExit(
|
||||
message: 'No Android SDK found. Try setting the ANDROID_HOME environment variable',
|
||||
message: 'No Android SDK found. Try setting the ANDROID_SDK_ROOT environment variable',
|
||||
));
|
||||
},
|
||||
overrides: <Type, Generator>{
|
||||
|
@ -197,7 +197,7 @@ void main() {
|
||||
arguments: <String>['--no-pub'],
|
||||
);
|
||||
}, throwsToolExit(
|
||||
message: 'No Android SDK found. Try setting the ANDROID_HOME environment variable',
|
||||
message: 'No Android SDK found. Try setting the ANDROID_SDK_ROOT environment variable',
|
||||
));
|
||||
},
|
||||
overrides: <Type, Generator>{
|
||||
|
@ -323,7 +323,7 @@ void main() {
|
||||
expect(() {
|
||||
updateLocalProperties(project: FlutterProject.current());
|
||||
}, throwsToolExit(
|
||||
message: '$warningMark No Android SDK found. Try setting the ANDROID_HOME environment variable.',
|
||||
message: '$warningMark No Android SDK found. Try setting the ANDROID_SDK_ROOT environment variable.',
|
||||
));
|
||||
}, overrides: <Type, Generator>{
|
||||
AndroidSdk: () => null,
|
||||
|
Loading…
x
Reference in New Issue
Block a user