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
39e4d9d1
Unverified
Commit
39e4d9d1
authored
Oct 18, 2019
by
Jonah Williams
Committed by
GitHub
Oct 18, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expand scope of rethrown gradle errors (#42966)
parent
f7018c2a
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
271 additions
and
4 deletions
+271
-4
gradle.dart
packages/flutter_tools/lib/src/android/gradle.dart
+31
-3
gradle_test.dart
...flutter_tools/test/general.shard/android/gradle_test.dart
+240
-1
No files found.
packages/flutter_tools/lib/src/android/gradle.dart
View file @
39e4d9d1
...
...
@@ -304,6 +304,18 @@ String _locateGradlewExecutable(Directory directory) {
return
null
;
}
// Gradle crashes for several known reasons when downloading that are not
// actionable by flutter.
const
List
<
String
>
_kKnownErrorPrefixes
=
<
String
>[
'java.io.FileNotFoundException: https://downloads.gradle.org'
,
'java.io.IOException: Unable to tunnel through proxy'
,
'java.lang.RuntimeException: Timeout of'
,
'java.util.zip.ZipException: error in opening zip file'
,
'javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake'
,
'java.net.SocketException: Connection reset'
,
'java.io.FileNotFoundException'
,
];
// Note: Gradle may be bootstrapped and possibly downloaded as a side-effect
// of validating the Gradle executable. This may take several seconds.
Future
<
String
>
_initializeGradle
(
FlutterProject
project
)
async
{
...
...
@@ -333,9 +345,25 @@ Future<String> _initializeGradle(FlutterProject project) async {
);
}
on
ProcessException
catch
(
e
)
{
final
String
error
=
e
.
toString
();
if
(
error
.
contains
(
'java.io.FileNotFoundException: https://downloads.gradle.org'
)
||
error
.
contains
(
'java.io.IOException: Unable to tunnel through proxy'
))
{
throwToolExit
(
'
$gradle
threw an error while trying to update itself.
\n
$e
'
);
// TODO(jonahwilliams): automatically retry on network errors.
if
(
_kKnownErrorPrefixes
.
any
((
String
candidate
)
=>
error
.
contains
(
candidate
)))
{
throwToolExit
(
'
$gradle
threw an error while trying to update itself.'
' Try rerunning to retry the update.
\n
$e
'
);
}
// gradlew is missing execute.
if
(
error
.
contains
(
'Permission denied'
))
{
throwToolExit
(
'
$gradle
does not have permission to execute by your user.
\n
'
'You should change the ownership of the project directory to your user'
', or move the project to a directory with execute permissions.
\n
$error
'
);
}
// No idea what went wrong but we can't do anything about it.
if
(
error
.
contains
(
'ProcessException: Process exited abnormally'
))
{
throwToolExit
(
'
$gradle
exited abnormally. Try rerunning with
\'
-v
\'
for more '
'infomration, or check the gradlew script above for errors.
\n
$error
'
);
}
rethrow
;
}
finally
{
...
...
packages/flutter_tools/test/general.shard/android/gradle_test.dart
View file @
39e4d9d1
This diff is collapsed.
Click to expand it.
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