Support ANDROID_SDK_ROOT in addition to ANDROID_HOME (#25221)
* Fall back to ANDROID_SDK_ROOT if ANDROID_HOME is not set And update descriptions to use the non-deprecated ANDROID_SDK_ROOT. Fixes #15114. * Remove trailing whitespace * Update dev/devicelab/lib/framework/adb.dart Co-Authored-By: DanTup <danny@tuppeny.com> * Reformat long line
This commit is contained in:
@@ -34,7 +34,7 @@ if [[ "$SHARD" = "deploy_gallery" ]]; then
|
||||
fi
|
||||
set -x
|
||||
|
||||
# ANDROID_HOME must be set in the env.
|
||||
# ANDROID_SDK_ROOT must be set in the env.
|
||||
(
|
||||
cd examples/flutter_gallery
|
||||
flutter build apk --release -t lib/main_publish.dart
|
||||
|
||||
@@ -184,7 +184,9 @@ Future<void> _flutterBuildAot(String relativePathToApplication) async {
|
||||
|
||||
Future<void> _flutterBuildApk(String relativePathToApplication) async {
|
||||
// TODO(dnfield): See if we can get Android SDK on all Cirrus platforms.
|
||||
if (Platform.environment['ANDROID_HOME']?.isEmpty ?? true) {
|
||||
if (
|
||||
(Platform.environment['ANDROID_HOME']?.isEmpty ?? true) &&
|
||||
(Platform.environment['ANDROID_SDK_ROOT']?.isEmpty ?? true)) {
|
||||
return;
|
||||
}
|
||||
print('Running APK build tests...');
|
||||
|
||||
@@ -102,9 +102,9 @@ reproduce a CI test failure locally.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
You must set the `ANDROID_HOME` 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`.
|
||||
You must set the `ANDROID_HOME` or `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`.
|
||||
|
||||
You can find where your Android SDK is using `flutter doctor`.
|
||||
|
||||
|
||||
@@ -461,11 +461,15 @@ class IosDevice implements Device {
|
||||
|
||||
/// Path to the `adb` executable.
|
||||
String get adbPath {
|
||||
final String androidHome = Platform.environment['ANDROID_HOME'];
|
||||
final String androidHome =
|
||||
Platform.environment['ANDROID_HOME'] != null
|
||||
? Platform.environment['ANDROID_HOME']
|
||||
: Platform.environment['ANDROID_SDK_ROOT'];
|
||||
|
||||
if (androidHome == null)
|
||||
throw 'ANDROID_HOME environment variable missing. This variable must '
|
||||
'point to the Android SDK directory containing platform-tools.';
|
||||
throw 'The ANDROID_SDK_ROOT and ANDROID_HOME environment variables are '
|
||||
'missing. At least one of these variables must point to the Android '
|
||||
'SDK directory containing platform-tools.';
|
||||
|
||||
final String adbPath = path.join(androidHome, 'platform-tools/adb');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user