mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Updated androidMissingSdkInstructions error message (#65964)
This commit is contained in:
parent
1f62776935
commit
3a5e45404d
@ -167,7 +167,7 @@ class AndroidValidator extends DoctorValidator {
|
||||
} else {
|
||||
// Instruct user to set [kAndroidSdkRoot] and not deprecated [kAndroidHome]
|
||||
// See https://github.com/flutter/flutter/issues/39301
|
||||
messages.add(ValidationMessage.error(_userMessages.androidMissingSdkInstructions(kAndroidSdkRoot, _platform)));
|
||||
messages.add(ValidationMessage.error(_userMessages.androidMissingSdkInstructions(_platform)));
|
||||
}
|
||||
return ValidationResult(ValidationType.missing, messages);
|
||||
}
|
||||
@ -198,7 +198,7 @@ class AndroidValidator extends DoctorValidator {
|
||||
_androidSdk.latestVersion.platformName,
|
||||
_androidSdk.latestVersion.buildToolsVersionName)));
|
||||
} else {
|
||||
messages.add(ValidationMessage.error(_userMessages.androidMissingSdkInstructions(kAndroidHome, _platform)));
|
||||
messages.add(ValidationMessage.error(_userMessages.androidMissingSdkInstructions(_platform)));
|
||||
}
|
||||
|
||||
if (_platform.environment.containsKey(kAndroidHome)) {
|
||||
|
||||
@ -69,13 +69,13 @@ class UserMessages {
|
||||
String androidBadSdkDir(String envKey, String homeDir) =>
|
||||
'$envKey = $homeDir\n'
|
||||
'but Android SDK not found at this location.';
|
||||
String androidMissingSdkInstructions(String envKey, Platform platform) =>
|
||||
String androidMissingSdkInstructions(Platform platform) =>
|
||||
'Unable to locate Android SDK.\n'
|
||||
'Install Android Studio from: https://developer.android.com/studio/index.html\n'
|
||||
'On first launch it will assist you in installing the Android SDK components.\n'
|
||||
'(or visit ${_androidSdkInstallUrl(platform)} for detailed instructions).\n'
|
||||
'If the Android SDK has been installed to a custom location, set $envKey to that location.\n'
|
||||
'You may also want to add it to your PATH environment variable.\n';
|
||||
'If the Android SDK has been installed to a custom location, please use\n'
|
||||
'`flutter config --android-sdk` to update to that location.\n';
|
||||
String androidSdkLocation(String directory) => 'Android SDK at $directory';
|
||||
String androidSdkPlatformToolsVersion(String platform, String tools) =>
|
||||
'Platform $platform, build-tools $tools';
|
||||
|
||||
@ -329,9 +329,15 @@ void main() {
|
||||
validationResult.messages.last.message,
|
||||
errorMessage,
|
||||
);
|
||||
expect(
|
||||
validationResult.messages.any(
|
||||
(ValidationMessage message) => message.message.contains('Unable to locate Android SDK')
|
||||
),
|
||||
false,
|
||||
);
|
||||
});
|
||||
|
||||
testWithoutContext('Mentions `kAndroidSdkRoot if user has no AndroidSdk`', () async {
|
||||
testWithoutContext('Mentions `flutter config --android-sdk if user has no AndroidSdk`', () async {
|
||||
final ValidationResult validationResult = await AndroidValidator(
|
||||
androidSdk: null,
|
||||
androidStudio: null,
|
||||
@ -343,7 +349,7 @@ void main() {
|
||||
).validate();
|
||||
expect(
|
||||
validationResult.messages.any(
|
||||
(ValidationMessage message) => message.message.contains(kAndroidSdkRoot)
|
||||
(ValidationMessage message) => message.message.contains('flutter config --android-sdk')
|
||||
),
|
||||
true,
|
||||
);
|
||||
|
||||
@ -23,7 +23,7 @@ void main() {
|
||||
|
||||
testWithoutContext('Android installation instructions', () {
|
||||
final UserMessages userMessages = UserMessages();
|
||||
_checkInstallationURL((Platform platform) => userMessages.androidMissingSdkInstructions('ANDROID_SDK_ROOT', platform));
|
||||
_checkInstallationURL((Platform platform) => userMessages.androidMissingSdkInstructions(platform));
|
||||
_checkInstallationURL((Platform platform) => userMessages.androidSdkInstallHelp(platform));
|
||||
_checkInstallationURL((Platform platform) => userMessages.androidMissingSdkManager('/', platform));
|
||||
_checkInstallationURL((Platform platform) => userMessages.androidCannotRunSdkManager('/', '', platform));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user