flutter / flutter

Flutter makes it easy and fast to build beautiful apps for mobile and beyond
https://flutter.dev
BSD 3-Clause "New" or "Revised" License
162.17k stars 26.65k forks source link

Proposal: add more details to message shown when the tool exits because it's unable to run adb #147436

Closed andrewkolos closed 2 weeks ago

andrewkolos commented 2 weeks ago

Occasionally, the Flutter daemon hosted by Visual Studio code on my machine will terminate unexpectedly. The last log message will look something like this:

[{"event":"daemon.logMessage","params":{"level":"error","message":"Unable to run \"adb\", check your Android SDK installation and ANDROID_HOME environment variable: /Users/andrewkolos/Library/Android/sdk/platform-tools/adb"}}]

From the fact that this only happens occasionally (1-3 times a week despite working on the flutter/flutter repo full-time), and the fact that I can normally invoke adb from my terminal just fine, I conclude that the reason for this crash is not something trivial (i.e. adb is not installed.) I think we should augment this crash message to include more useful information so that this can be investigated further.

Relevant code:

https://github.com/flutter/flutter/blob/26e379e0fcd93981572d48d5b695ed6fa6279061/packages/flutter_tools/lib/src/android/android_device_discovery.dart#L64-L86

I propose we augment the throwToolExit call to include the exception's message.

andrewkolos commented 2 weeks ago

Arguably related: https://github.com/flutter/flutter/issues/144902

guidezpl commented 2 weeks ago

Ah I see you're also affected, https://github.com/flutter/flutter/issues/125971

andrewkolos commented 2 weeks ago

Ah I see you're also affected, #125971

Oh cool, I'll close this as a duplicate of #125971

github-actions[bot] commented 1 day ago

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.