Repository: flutter
Issue: [proposal] provide better error message when gradle build fails due to connectivity issues / VPN
Labels: tool,c: proposal,P3,team-tool,triaged-tool

### Is there an existing issue for this?

- [X] I have searched the [existing issues](https://github.com/flutter/flutter/issues)
- [X] I have read the [guide to filing a bug](https://flutter.dev/docs/resources/bug-reports)

### Steps to reproduce


1. follow [docs](https://docs.flutter.dev/get-started/install/macos) for fresh install of flutter for macOS 14.1
2. create a new app running `flutter create gradle_issue`
3. connect a device running android 12 (in my case pixel 3a)
3. `cd` on the app folder and run `flutter run -v` *while using VPN*

<details>
  <summary>neofetch</summary>
  
```   
                'c.          francesco@Francescos-MacBook-Air.local
                 ,xNMM.          --------------------------------------
               .OMMMMo           OS: macOS 14.1 23B74 arm64
               OMMM0,            Host: MacBookAir10,1
     .;loddo:' loolloddol;.      Kernel: 23.1.0
   cKMMMMMMMMMMNWMMMMMMMMMM0:    Uptime: 8 hours, 11 mins
 .KMMMMMMMMMMMMMMMMMMMMMMMWd.    Packages: 56 (brew)
 XMMMMMMMMMMMMMMMMMMMMMMMX.      Shell: zsh 5.9
;MMMMMMMMMMMMMMMMMMMMMMMM:       Resolution: 1440x900
:MMMMMMMMMMMMMMMMMMMMMMMM:       DE: Aqua
.MMMMMMMMMMMMMMMMMMMMMMMMX.      WM: Quartz Compositor
 kMMMMMMMMMMMMMMMMMMMMMMMMWd.    WM Theme: Blue (Dark)
 .XMMMMMMMMMMMMMMMMMMMMMMMMMMk   Terminal: WarpTerminal
  .XMMMMMMMMMMMMMMMMMMMMMMMMK.   CPU: Apple M1
    kMMMMMMMMMMMMMMMMMMMMMMd     GPU: Apple M1
     ;KMMMMMMMWXXWMMMMMMMk.      Memory: 1605MiB / 8192MiB
       .cooc,.    .,coo:.
    
```
    
    
</details>

### Expected results

~~flutter should run out of the box~~

when failing due to connectivity issue flutter could provide the user with a meaningful error message

### Actual results

~~the application fails to launch in both debug and release mode~~
~~note that runs without issues with ios simulator~~

flutter error message is very hard to read, only after careful observation
the "hint" of a failure to download gradle resources suggested the possible cause of the issue

### Code sample

the default counter app generated by `flutter create ...`

### Screenshots or Video

N/A

### Logs

<details><summary>Logs</summary>

```console
flutter run -v

[... see logs attached]

[+1674 ms] Exception: Gradle task assembleDebug failed with exit code 1
[   +2 ms] "flutter run" took 7,557ms.
[   +2 ms]
           #0      throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
           #1      RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:760:9)
           <asynchronous suspension>
           #2      FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1297:27)
           <asynchronous suspension>
           #3      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #4      CommandRunner.runCommand (package:args/command_runner.dart:212:13)
           <asynchronous suspension>
           #5      FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:339:9)
           <asynchronous suspension>
           #6      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #7      FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:285:5)
           <asynchronous suspension>
           #8      run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:115:9)
           <asynchronous suspension>
           #9      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #10     main (package:flutter_tools/executable.dart:90:3)
           <asynchronous suspension>


[  +49 ms] ensureAnalyticsSent: 44ms
[        ] Running 1 shutdown hook
[   +1 ms] Shutdown hooks complete
[        ] exiting with code 1
```

</details>

[logs.txt](https://github.com/flutter/flutter/files/13257316/logs.txt)



### Flutter Doctor output

<details><summary>Doctor output</summary>

```console
flutter doctor -v
[✓] Flutter (Channel stable, 3.13.9, on macOS 14.1 23B74 darwin-arm64, locale en-US)
    • Flutter version 3.13.9 on channel stable at /Users/francesco/fvm/versions/stable
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision d211f42860 (10 days ago), 2023-10-25 13:42:25 -0700
    • Engine revision 0545f8705d
    • Dart version 3.1.5
    • DevTools version 2.25.0

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/francesco/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.0.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15A507
    • CocoaPods version 1.14.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)

[✓] VS Code (version 1.84.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.76.0

[✓] Connected device (3 available)
    • Pixel 3a (mobile) • 965AY0WP5C • android-arm64  • Android 12 (API 32)
    • macOS (desktop)   • macos      • darwin-arm64   • macOS 14.1 23B74 darwin-arm64
    • Chrome (web)      • chrome     • web-javascript • Google Chrome 118.0.5993.117

[✓] Network resources
    • All expected network resources are available.

• No issues found!

</details>