Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
andrewkolos opened this issue Apr 26, 2024 · 3 comments
Assignees
Labels
P2 Important issues not at the top of the work list team-tool Owned by Flutter Tool team tool Affects the "flutter" command-line tool. See also t: labels. triaged-tool Triaged by Flutter Tool team

Comments

@andrewkolos
Copy link
Contributor

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:

@override
Future<List<Device>> pollingGetDevices({ Duration? timeout }) async {
if (_doesNotHaveAdb()) {
return <AndroidDevice>[];
}
String text;
try {
text = (await _processUtils.run(<String>[_androidSdk!.adbPath!, 'devices', '-l'],
throwOnError: true,
)).stdout.trim();
} on ProcessException catch (exception) {
throwToolExit(
'Unable to run "adb", check your Android SDK installation and '
'$kAndroidHome environment variable: ${exception.executable}',
);
}
final List<AndroidDevice> devices = <AndroidDevice>[];
_parseADBDeviceOutput(
text,
devices: devices,
);
return devices;
}

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

@andrewkolos andrewkolos added tool Affects the "flutter" command-line tool. See also t: labels. P2 Important issues not at the top of the work list team-tool Owned by Flutter Tool team triaged-tool Triaged by Flutter Tool team labels Apr 26, 2024
@andrewkolos andrewkolos self-assigned this Apr 26, 2024
@andrewkolos andrewkolos changed the title Add more details to message shown when the tool exits because it's unable to run adb Prosal: add more details to message shown when the tool exits because it's unable to run adb Apr 26, 2024
@andrewkolos andrewkolos changed the title Prosal: add more details to message shown when the tool exits because it's unable to run adb Proposal: add more details to message shown when the tool exits because it's unable to run adb Apr 26, 2024
@andrewkolos
Copy link
Contributor Author

Arguably related: #144902

@guidezpl
Copy link
Member

Ah I see you're also affected, #125971

@andrewkolos
Copy link
Contributor Author

Ah I see you're also affected, #125971

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

@andrewkolos andrewkolos closed this as not planned Won't fix, can't repro, duplicate, stale Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 Important issues not at the top of the work list team-tool Owned by Flutter Tool team tool Affects the "flutter" command-line tool. See also t: labels. triaged-tool Triaged by Flutter Tool team
Projects
None yet
Development

No branches or pull requests

2 participants