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
bef8d081
Commit
bef8d081
authored
Feb 17, 2016
by
Adam Barth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve error message when Android SDK not found
Also, look for the Android SDK in the default locations.
parent
58de420e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
7 deletions
+19
-7
android_sdk.dart
packages/flutter_tools/lib/src/android/android_sdk.dart
+17
-5
apk.dart
packages/flutter_tools/lib/src/commands/apk.dart
+2
-2
No files found.
packages/flutter_tools/lib/src/android/android_sdk.dart
View file @
bef8d081
...
...
@@ -49,12 +49,24 @@ class AndroidSdk {
static
AndroidSdk
locateAndroidSdk
()
{
// TODO: Use explicit configuration information from a metadata file?
String
androidHomeDir
;
if
(
Platform
.
environment
.
containsKey
(
'ANDROID_HOME'
))
{
String
homeDir
=
Platform
.
environment
[
'ANDROID_HOME'
];
if
(
validSdkDirectory
(
homeDir
))
return
new
AndroidSdk
(
homeDir
);
if
(
validSdkDirectory
(
path
.
join
(
homeDir
,
'sdk'
)))
return
new
AndroidSdk
(
path
.
join
(
homeDir
,
'sdk'
));
androidHomeDir
=
Platform
.
environment
[
'ANDROID_HOME'
];
}
else
if
(
Platform
.
isLinux
)
{
String
homeDir
=
Platform
.
environment
[
'HOME'
];
if
(
homeDir
!=
null
)
androidHomeDir
=
'
$homeDir
/Android/Sdk'
;
}
else
if
(
Platform
.
isMacOS
)
{
String
homeDir
=
Platform
.
environment
[
'HOME'
];
if
(
homeDir
!=
null
)
androidHomeDir
=
'
$homeDir
/Library/Android/sdk'
;
}
if
(
androidHomeDir
!=
null
)
{
if
(
validSdkDirectory
(
androidHomeDir
))
return
new
AndroidSdk
(
androidHomeDir
);
if
(
validSdkDirectory
(
path
.
join
(
androidHomeDir
,
'sdk'
)))
return
new
AndroidSdk
(
path
.
join
(
androidHomeDir
,
'sdk'
));
}
File
aaptBin
=
os
.
which
(
'aapt'
);
// in build-tools/$version/aapt
...
...
packages/flutter_tools/lib/src/commands/apk.dart
View file @
bef8d081
...
...
@@ -177,7 +177,7 @@ class ApkCommand extends FlutterCommand {
Future
<
int
>
runInProject
()
async
{
// Validate that we can find an android sdk.
if
(
androidSdk
==
null
)
{
printError
(
'No Android SDK found.'
);
printError
(
'No Android SDK found.
Try setting the ANDROID_HOME environment variable.
'
);
return
1
;
}
...
...
@@ -371,7 +371,7 @@ Future<int> buildAndroid({
})
async
{
// Validate that we can find an android sdk.
if
(
androidSdk
==
null
)
{
printError
(
'No Android SDK found.'
);
printError
(
'No Android SDK found.
Try setting the ANDROID_HOME environment variable.
'
);
return
1
;
}
...
...
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