Unverified Commit 8ca7d7d1 authored by Christopher Fujino's avatar Christopher Fujino Committed by GitHub

Stop recommending android sdk root (#136296)

Fixes https://github.com/flutter/flutter/issues/117245
parent e83f53e6
...@@ -107,7 +107,7 @@ String get _androidHome { ...@@ -107,7 +107,7 @@ String get _androidHome {
final String? androidHome = Platform.environment['ANDROID_HOME'] ?? final String? androidHome = Platform.environment['ANDROID_HOME'] ??
Platform.environment['ANDROID_SDK_ROOT']; Platform.environment['ANDROID_SDK_ROOT'];
if (androidHome == null || androidHome.isEmpty) { if (androidHome == null || androidHome.isEmpty) {
throw Exception('Environment variable `ANDROID_SDK_ROOT` is not set.'); throw Exception('Environment variable `ANDROID_HOME` is not set.');
} }
return androidHome; return androidHome;
} }
......
...@@ -1346,7 +1346,7 @@ String get adbPath { ...@@ -1346,7 +1346,7 @@ String get adbPath {
if (androidHome == null) { if (androidHome == null) {
throw const DeviceException( throw const DeviceException(
'The ANDROID_SDK_ROOT environment variable is ' 'The ANDROID_HOME environment variable is '
'missing. The variable must point to the Android ' 'missing. The variable must point to the Android '
'SDK directory containing platform-tools.' 'SDK directory containing platform-tools.'
); );
......
...@@ -74,7 +74,7 @@ class AndroidDevices extends PollingDeviceDiscovery { ...@@ -74,7 +74,7 @@ class AndroidDevices extends PollingDeviceDiscovery {
} on ProcessException catch (exception) { } on ProcessException catch (exception) {
throwToolExit( throwToolExit(
'Unable to run "adb", check your Android SDK installation and ' 'Unable to run "adb", check your Android SDK installation and '
'$kAndroidSdkRoot environment variable: ${exception.executable}', '$kAndroidHome environment variable: ${exception.executable}',
); );
} }
final List<AndroidDevice> devices = <AndroidDevice>[]; final List<AndroidDevice> devices = <AndroidDevice>[];
......
...@@ -10,27 +10,27 @@ import '../convert.dart'; ...@@ -10,27 +10,27 @@ import '../convert.dart';
import '../globals.dart' as globals; import '../globals.dart' as globals;
import 'java.dart'; import 'java.dart';
// ANDROID_HOME is deprecated. // ANDROID_SDK_ROOT is deprecated.
// See https://developer.android.com/studio/command-line/variables.html#envar // See https://developer.android.com/studio/command-line/variables.html#envar
const String kAndroidHome = 'ANDROID_HOME';
const String kAndroidSdkRoot = 'ANDROID_SDK_ROOT'; const String kAndroidSdkRoot = 'ANDROID_SDK_ROOT';
const String kAndroidHome = 'ANDROID_HOME';
final RegExp _numberedAndroidPlatformRe = RegExp(r'^android-([0-9]+)$'); final RegExp _numberedAndroidPlatformRe = RegExp(r'^android-([0-9]+)$');
final RegExp _sdkVersionRe = RegExp(r'^ro.build.version.sdk=([0-9]+)$'); final RegExp _sdkVersionRe = RegExp(r'^ro.build.version.sdk=([0-9]+)$');
// Android SDK layout: // Android SDK layout:
// $ANDROID_SDK_ROOT/platform-tools/adb // $ANDROID_HOME/platform-tools/adb
// $ANDROID_SDK_ROOT/build-tools/19.1.0/aapt, dx, zipalign // $ANDROID_HOME/build-tools/19.1.0/aapt, dx, zipalign
// $ANDROID_SDK_ROOT/build-tools/22.0.1/aapt // $ANDROID_HOME/build-tools/22.0.1/aapt
// $ANDROID_SDK_ROOT/build-tools/23.0.2/aapt // $ANDROID_HOME/build-tools/23.0.2/aapt
// $ANDROID_SDK_ROOT/build-tools/24.0.0-preview/aapt // $ANDROID_HOME/build-tools/24.0.0-preview/aapt
// $ANDROID_SDK_ROOT/build-tools/25.0.2/apksigner // $ANDROID_HOME/build-tools/25.0.2/apksigner
// $ANDROID_SDK_ROOT/platforms/android-22/android.jar // $ANDROID_HOME/platforms/android-22/android.jar
// $ANDROID_SDK_ROOT/platforms/android-23/android.jar // $ANDROID_HOME/platforms/android-23/android.jar
// $ANDROID_SDK_ROOT/platforms/android-N/android.jar // $ANDROID_HOME/platforms/android-N/android.jar
class AndroidSdk { class AndroidSdk {
AndroidSdk(this.directory, { AndroidSdk(this.directory, {
Java? java, Java? java,
......
...@@ -742,7 +742,7 @@ void exitWithNoSdkMessage() { ...@@ -742,7 +742,7 @@ void exitWithNoSdkMessage() {
flutterUsage: globals.flutterUsage) flutterUsage: globals.flutterUsage)
.send(); .send();
throwToolExit('${globals.logger.terminal.warningMark} No Android SDK found. ' throwToolExit('${globals.logger.terminal.warningMark} No Android SDK found. '
'Try setting the ANDROID_SDK_ROOT environment variable.'); 'Try setting the ANDROID_HOME environment variable.');
} }
// Data class to hold normal/defined Java <-> Gradle compatability criteria. // Data class to hold normal/defined Java <-> Gradle compatability criteria.
......
...@@ -228,7 +228,7 @@ void main() { ...@@ -228,7 +228,7 @@ void main() {
arguments: <String>['--no-pub'], arguments: <String>['--no-pub'],
); );
}, throwsToolExit( }, throwsToolExit(
message: 'No Android SDK found. Try setting the ANDROID_SDK_ROOT environment variable', message: 'No Android SDK found. Try setting the ANDROID_HOME environment variable',
)); ));
}, },
overrides: <Type, Generator>{ overrides: <Type, Generator>{
......
...@@ -138,7 +138,7 @@ void main() { ...@@ -138,7 +138,7 @@ void main() {
arguments: <String>['--no-pub'], arguments: <String>['--no-pub'],
), ),
throwsToolExit( throwsToolExit(
message: 'No Android SDK found. Try setting the ANDROID_SDK_ROOT environment variable', message: 'No Android SDK found. Try setting the ANDROID_HOME environment variable',
), ),
); );
}, },
......
...@@ -113,7 +113,7 @@ void main() { ...@@ -113,7 +113,7 @@ void main() {
arguments: <String>['--no-pub'], arguments: <String>['--no-pub'],
); );
}, throwsToolExit( }, throwsToolExit(
message: 'No Android SDK found. Try setting the ANDROID_SDK_ROOT environment variable', message: 'No Android SDK found. Try setting the ANDROID_HOME environment variable',
)); ));
}, },
overrides: <Type, Generator>{ overrides: <Type, Generator>{
......
...@@ -198,7 +198,7 @@ void main() { ...@@ -198,7 +198,7 @@ void main() {
expect(() { expect(() {
gradle_utils.updateLocalProperties(project: FlutterProject.fromDirectoryTest(globals.fs.currentDirectory)); gradle_utils.updateLocalProperties(project: FlutterProject.fromDirectoryTest(globals.fs.currentDirectory));
}, throwsToolExit( }, throwsToolExit(
message: '${globals.logger.terminal.warningMark} No Android SDK found. Try setting the ANDROID_SDK_ROOT environment variable.', message: '${globals.logger.terminal.warningMark} No Android SDK found. Try setting the ANDROID_HOME environment variable.',
)); ));
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
AndroidSdk: () => null, AndroidSdk: () => null,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment