Repository navigation
[tools] flutter doctor reports Android Studio twice when installed from JetBrains Toolbox #86291
Description
Activity
- changed the title
[-][tools] `flutter doctor` reports Android Studio installed from JetBrains Toolbox twice[/-][+][tools] `flutter doctor` reports Android Studio twice when installed from JetBrains Toolbox [/+]on Jul 12, 2021 - addedin triagePresently being triaged by the triage teamPresently being triaged by the triage team
on Jul 13, 2021 Verified this on latest stable and master and observed the same behavior.
stable flutter doctor -v
[✓] Flutter (Channel stable, 2.2.3, on Mac OS X 10.15.4 19E2269 darwin-x64, locale en-GB) • Flutter version 2.2.3 at /Users/dhs/documents/fluttersdk/flutter • Framework revision f4abaa0735 (4 days ago), 2021-07-01 12:46:11 -0700 • Engine revision 241c87ad80 • Dart version 2.13.4 [✓] Android toolchain - develop for Android devices (Android SDK version 30) • Android SDK at /Users/dhs/Library/Android/sdk • Platform android-30, build-tools 30.0.3 • ANDROID_HOME = /Users/dhs/Library/Android/sdk • Java binary at: /Users/dhs/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/202.7486908/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS • Xcode at /Applications/Xcode.app/Contents/Developer • Xcode 12.3, Build version 12C33 • CocoaPods version 1.10.1 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 4.1) • Android Studio at /Users/dhs/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/202.7486908/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 1.8.0_242-release-1644-b3-6915495) [✓] VS Code (version 1.57.1) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.21.0 [✓] Connected device (3 available) • iPhone 12 Pro Max (mobile) • A5473606-0213-4FD8-BA16-553433949729 • ios • com.apple.CoreSimulator.SimRuntime.iOS-14-3 (simulator) • macOS (desktop) • macos • darwin-x64 • Mac OS X 10.15.4 19E2269 darwin-x64 • Chrome (web) • chrome • web-javascript • Google Chrome 91.0.4472.114 • No issues found!master flutter doctor -v
[✓] Flutter (Channel master, 2.4.0-1.0.pre.200, on Mac OS X 10.15.4 19E2269 darwin-x64, locale en-GB) • Flutter version 2.4.0-1.0.pre.200 at /Users/dhs/documents/fluttersdk/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 81a85b8939 (7 hours ago), 2021-07-12 22:01:02 -0400 • Engine revision a984a833ba • Dart version 2.14.0 (build 2.14.0-301.0.dev) [✓] Android toolchain - develop for Android devices (Android SDK version 30) • Android SDK at /Users/dhs/Library/Android/sdk • Platform android-30, build-tools 30.0.3 • ANDROID_HOME = /Users/dhs/Library/Android/sdk • Java binary at: /Users/dhs/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/202.7486908/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS • Xcode at /Applications/Xcode.app/Contents/Developer • Xcode 12.3, Build version 12C33 • CocoaPods version 1.10.1 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 4.1) • Android Studio at /Users/dhs/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/202.7486908/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 1.8.0_242-release-1644-b3-6915495) [✓] Android Studio (version 4.1) • Android Studio at /Users/dhs/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/202.7486908/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 1.8.0_242-release-1644-b3-6915495) [✓] VS Code (version 1.57.1) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.21.0 [✓] Connected device (3 available) • iPhone 12 Pro Max (mobile) • A5473606-0213-4FD8-BA16-553433949729 • ios • com.apple.CoreSimulator.SimRuntime.iOS-14-3 (simulator) • macOS (desktop) • macos • darwin-x64 • Mac OS X 10.15.4 19E2269 darwin-x64 • Chrome (web) • chrome • web-javascript • Google Chrome 91.0.4472.114 • No issues found!- addeda: qualityA truly polished experienceA truly polished experiencefound in release: 2.4Found to occur in 2.4Found to occur in 2.4has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work ont: flutter doctorProblem related to the "flutter doctor" toolProblem related to the "flutter doctor" tooltoolAffects the "flutter" command-line tool. See also t: labels.Affects the "flutter" command-line tool. See also t: labels.and removedin triagePresently being triaged by the triage teamPresently being triaged by the triage team
on Jul 13, 2021 I have tried on Windows and Linux last night, there is no duplication, this seems to be specific to macOS
I will fix this soon- addedplatform-macosBuilding on or for macOS specificallyBuilding on or for macOS specifically
on Jul 13, 2021 - addedP2Important issues not at the top of the work listImportant issues not at the top of the work list
on Jul 13, 2021 I bet this needs deduplication, like making
candidatePathsa set instead of a list.
flutter/packages/flutter_tools/lib/src/android/android_studio.dart
Lines 318 to 321 in 3c72ef3
return candidatePaths .map<AndroidStudio>((FileSystemEntity e) => AndroidStudio.fromMacOSBundle(e.path)) .whereType<AndroidStudio>() .toList(); I see the problem. The bundle finder is discovering
~/Applications/JetBrains Toolbox/Android Studio.appand~/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/203.7583922/Android Studio.app. The former has its Info.plistJetBrainsToolboxAppis pointing to the latter~/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/203.7583922/Android Studio.app. The latter does not have aJetBrainsToolboxAppin its Info.plistflutter/packages/flutter_tools/lib/src/android/android_studio.dart
Lines 47 to 50 in f9aa584
// As AndroidStudio managed by JetBrainsToolbox could have a wrapper pointing to the real Android Studio. // Check if we've found a JetBrainsToolbox wrapper and deal with it properly. final String? jetBrainsToolboxAppBundlePath = plistValues['JetBrainsToolboxApp'] as String?; if (jetBrainsToolboxAppBundlePath != null) { So the path discovery logic works as of the addition of #80475, but the
AndroidStudio.fromMacOSBundle(e.path)is finding both.From #87005 (comment)
I think we can instead get rid of the logic that parses that Info.plist file to follow the
JetBrainsToolboxApppath since as of #80475 it already handles finding the "real" Android Studio via Spotlight.A way to do this would be to change
flutter/packages/flutter_tools/lib/src/android/android_studio.dart
Lines 319 to 322 in f9aa584
return candidatePaths .map<AndroidStudio>((FileSystemEntity e) => AndroidStudio.fromMacOSBundle(e.path)) .whereType<AndroidStudio>() .toList(); to:
return candidatePaths .map<AndroidStudio?>((FileSystemEntity e) => AndroidStudio.fromMacOSBundle(e.path)) .whereType<AndroidStudio>() .toList();
and
flutter/packages/flutter_tools/lib/src/android/android_studio.dart
Lines 43 to 54 in f9aa584
factory AndroidStudio.fromMacOSBundle(String bundlePath) { String studioPath = globals.fs.path.join(bundlePath, 'Contents'); String plistFile = globals.fs.path.join(studioPath, 'Info.plist'); Map<String, dynamic> plistValues = globals.plistParser.parseFile(plistFile); // As AndroidStudio managed by JetBrainsToolbox could have a wrapper pointing to the real Android Studio. // Check if we've found a JetBrainsToolbox wrapper and deal with it properly. final String? jetBrainsToolboxAppBundlePath = plistValues['JetBrainsToolboxApp'] as String?; if (jetBrainsToolboxAppBundlePath != null) { studioPath = globals.fs.path.join(jetBrainsToolboxAppBundlePath, 'Contents'); plistFile = globals.fs.path.join(studioPath, 'Info.plist'); plistValues = globals.plistParser.parseFile(plistFile); } to
static AndroidStudio? fromMacOSBundle(String bundlePath) { final String studioPath = globals.fs.path.join(bundlePath, 'Contents'); final String plistFile = globals.fs.path.join(studioPath, 'Info.plist'); final Map<String, dynamic> plistValues = globals.plistParser.parseFile(plistFile); // As AndroidStudio managed by JetBrainsToolbox could have a wrapper pointing to the real Android Studio. // If we've found a JetBrainsToolbox wrapper, ignore it. if (plistValues.containsKey('JetBrainsToolboxApp')) { return null; }
@TahaTesser let me know if you want to keep working on this, or I'd be happy to put out a PR for you to review.
Reacted by Taha Tesser@jmagman
I will file a new one tomorrow, appreciate it so muchReacted by Jenn MagderI will file a new one tomorrow, appreciate it so much
No rush!
- addedr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer version
on Aug 18, 2021 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 -vand a minimal reproduction of the issue.- locked as resolved and limited conversation to collaborators
on Sep 1, 2021
On the latest Flutter
stablechannel[✓] Flutter (Channel stable, 2.2.3, on macOS 12.0 21A5268h darwin-x64, locale en-GB), Android Studio is reported once (as expected)flutter doctor -v
Other Flutter channels, from the latest
betatomaster,flutter doctorreports Android Studio twice when installed using JetBrains Toolbox.Check
flutter doctor -voutputs for each channel below.flutter doctor -v