Repository: flutter
Issue: Flutter crashes with ProcessException on Windows 10
Labels: c: crash,tool,platform-windows,t: gradle,customer: crowd,P2,team-tool,triaged-tool

I set all the paths correctly, accepted licenses, but `flutter.bat` outputs `The system cannot find the path specified.` twice during its execution and it finally crashes with a `ProcessException` immediately after the initializing Gradle message.  A similar issue was reported @SushiRoll53 in #35391, and @mikhail-tokarev said that this is related to accepting licenses, closing the issue. However, this seems to be unrelated to the licenses. In my case, all licenses accepted (as seen in the log below), all SDKs up-to-date, and I'm still getting this error even in freshly created Flutter projects. This is a serious problem that prevents me from making any updates to my existing applications and keeping them updated. Please find the log below:

<!-- Thank you for using Flutter!

     If you are looking for support, please check out our documentation
     or consider asking a question on Stack Overflow:
      * https://flutter.dev/
      * https://api.flutter.dev/
      * https://stackoverflow.com/questions/tagged/flutter?sort=frequent

     If you have found a bug or if our documentation doesn't have an answer
     to what you're looking for, then fill our the template below. Please read
     our guide to filing a bug first: https://flutter.dev/docs/resources/bug-reports
-->

## Steps to Reproduce

<!-- Please tell us exactly how to reproduce the problem you are running into. -->

1. Create a fresh Flutter project.
2. Make any `flutter run` or `flutter build` command and get the error.
3. See the terminal output below:

```

D:\test-app\testapp>flutter build appbundle
The system cannot find the path specified.
The system cannot find the path specified.

Initializing gradle...                          Sending crash report to Google.
Crash report sent (report ID: e3186bb0f5870f65)
Initializing gradle...                                                 \Oops; flutter has exited unexpectedly.
Crash report written to D:\test-app\testapp\flutter_05.log;
please let us know at https://github.com/flutter/flutter/issues.                                                       -
```

## Logs

<!--
      Include the full logs of the commands you are running between the lines
      with the backticks below. If you are running any "flutter" commands,
      please include the output of running them with "--verbose"; for example,
      the output of running "flutter --verbose create foo".
-->
Flutter crash report; please file at https://github.com/flutter/flutter/issues.

## command

flutter build appbundle

## exception

ProcessException: ProcessException: Process "D:\test-app\testapp\android\gradlew.bat" exited abnormally:

------------------------------------------------------------
Gradle 4.10.2
------------------------------------------------------------

Build time:   2018-09-19 18:10:15 UTC
Revision:     b4d8d5d170bb4ba516e88d7fe5647e2323d791dd

Kotlin DSL:   1.0-rc-6
Kotlin:       1.2.61
Groovy:       2.4.15
Ant:          Apache Ant(TM) version 1.9.11 compiled on March 23 2018
JVM:          1.8.0_202-release (JetBrains s.r.o 25.202-b03)
OS:           Windows 10 10.0 amd64


The system cannot find the path specified.
  Command: D:\test-app\testapp\android\gradlew.bat -v

```
#0      runCheckedAsync (package:flutter_tools/src/base/process.dart:259:7)
<asynchronous suspension>
#1      _initializeGradle (package:flutter_tools/src/android/gradle.dart:300:9)
<asynchronous suspension>
#2      _ensureGradle (package:flutter_tools/src/android/gradle.dart:281:37)
<asynchronous suspension>
#3      buildGradleProject (package:flutter_tools/src/android/gradle.dart:484:31)
<asynchronous suspension>
#4      buildAppBundle (package:flutter_tools/src/android/app_bundle.dart:43:10)
<asynchronous suspension>
#5      BuildAppBundleCommand.runCommand (package:flutter_tools/src/commands/build_appbundle.dart:47:11)
<asynchronous suspension>
#6      FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:490:18)
#7      _asyncThenWrapperHelper.<anonymous closure> (dart:async-patch/async_patch.dart:71:64)
#8      _rootRunUnary (dart:async/zone.dart:1132:38)
#9      _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#10     _FutureListener.handleValue (dart:async/future_impl.dart:137:18)
#11     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:678:45)
#12     Future._propagateToListeners (dart:async/future_impl.dart:707:32)
#13     Future._completeWithValue (dart:async/future_impl.dart:522:5)
#14     Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:552:7)
#15     _rootRun (dart:async/zone.dart:1124:13)
#16     _CustomZone.run (dart:async/zone.dart:1021:19)
#17     _CustomZone.runGuarded (dart:async/zone.dart:923:7)
#18     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:963:23)
#19     _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
#20     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
#21     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:116:13)
#22     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:173:5)
```

## flutter doctor

```
[32m[✓][39m Flutter (Channel stable, v1.9.1+hotfix.6, on Windows, locale en-US)
    [32m•[39m Flutter version 1.9.1+hotfix.6 at C:\flutter
    [32m•[39m Framework revision 68587a0916 (3 months ago), 2019-09-13 19:46:58 -0700
    [32m•[39m Engine revision b863200c37
    [32m•[39m Dart version 2.5.0

[32m[✓][39m Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    [32m•[39m Android SDK at C:\android-sdk
    [32m•[39m Android NDK location not configured (optional; useful for native profiling support)
    [32m•[39m Platform android-29, build-tools 29.0.2
    [32m•[39m ANDROID_HOME = C:\android-sdk
    [32m•[39m Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    [32m•[39m Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
    [32m•[39m All Android licenses accepted.

[32m[✓][39m Android Studio (version 3.5)
    [32m•[39m Android Studio at C:\Program Files\Android\Android Studio
    [32m•[39m Flutter plugin version 29.0.2
    [32m•[39m Dart plugin version 181.5616
    [32m•[39m Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)

[32m[✓][39m VS Code (version 1.40.2)
    [32m•[39m VS Code at C:\Users\ailabs\AppData\Local\Programs\Microsoft VS Code
    [32m•[39m Flutter extension version 3.6.0

[32m[✓][39m Connected device (1 available)
    [32m•[39m GM 8 • 7bf26878 • android-arm64 • Android 9 (API 28)

[32m•[39m No issues found!
```