Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
ae8586cf
Unverified
Commit
ae8586cf
authored
May 15, 2018
by
liyuqian
Committed by
GitHub
May 15, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show help info instead of crashing if Android SDK is not found (#17610)
Fixes #16832
parent
c36ec760
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
0 deletions
+23
-0
gradle.dart
packages/flutter_tools/lib/src/android/gradle.dart
+3
-0
gradle_test.dart
packages/flutter_tools/test/android/gradle_test.dart
+20
-0
No files found.
packages/flutter_tools/lib/src/android/gradle.dart
View file @
ae8586cf
...
...
@@ -209,6 +209,9 @@ void updateLocalProperties({String projectPath, BuildInfo buildInfo}) {
settings
=
new
SettingsFile
.
parseFromFile
(
localProperties
);
}
else
{
settings
=
new
SettingsFile
();
if
(
androidSdk
==
null
)
{
throwToolExit
(
'Unable to locate Android SDK. Please run `flutter doctor` for more details.'
);
}
settings
.
values
[
'sdk.dir'
]
=
escapePath
(
androidSdk
.
directory
);
changed
=
true
;
}
...
...
packages/flutter_tools/test/android/gradle_test.dart
View file @
ae8586cf
...
...
@@ -7,8 +7,28 @@ import 'package:flutter_tools/src/base/file_system.dart';
import
'package:flutter_tools/src/build_info.dart'
;
import
'package:test/test.dart'
;
import
'../src/common.dart'
;
void
main
(
)
{
group
(
'gradle build'
,
()
{
test
(
'do not crash if there is no Android SDK'
,
()
{
Exception
shouldBeToolExit
;
try
{
// We'd like to always set androidSdk to null and test updateLocalProperties. But that's
// currently impossible as the test is not hermetic. Luckily, our bots don't have Android
// SDKs yet so androidSdk should be null by default.
//
// This test is written to fail if our bots get Android SDKs in the future: shouldBeToolExit
// will be null and our expectation would fail. That would remind us to make these tests
// hermetic before adding Android SDKs to the bots.
updateLocalProperties
();
}
on
Exception
catch
(
e
)
{
shouldBeToolExit
=
e
;
}
// Ensure that we throw a meaningful ToolExit instead of a general crash.
expect
(
shouldBeToolExit
,
isToolExit
);
});
test
(
'regexp should only match lines without the error message'
,
()
{
final
List
<
String
>
nonMatchingLines
=
<
String
>[
'NDK is missing a "platforms" directory.'
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment