flutter / flutter-intellij

Flutter Plugin for IntelliJ
https://flutter.dev/using-ide
BSD 3-Clause "New" or "Revised" License
1.98k stars 319 forks source link

`flutter doctor -v` cannot determine versions of Flutter and Dart intellij plugins (MacOS) #7657

Open Sameri11 opened 1 month ago

Sameri11 commented 1 month ago

Steps to reproduce

  1. Make sure Flutter and/or Dart plugins installed in Android Studio
  2. Run flutter doctor -v

Tested on these versions of Android Studio:

Expected results

I expect output of flutter doctor -v to show version of Dart and Flutter plugins installed in Android Studio. Expected output:

[✓] Android Studio (version 2024.1)
    • Android Studio at /Users/samer/Applications/Android Studio Koala Feature Drop 2024.1.2.app/Contents
    • Flutter plugin version 81.0.2
    • Dart plugin version 241.18808
    • Java version OpenJDK Runtime Environment (build 17.0.11+0-17.0.11b1207.24-11852314)

Actual results

doctor can not determine versions of Dart and Flutter plugins. Actual output :

[✓] Android Studio (version 2024.1)
    • Android Studio at /Users/samer/Applications/Android Studio Koala Feature Drop 2024.1.2.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.11+0-17.0.11b1207.24-11852314)

Code sample

Code sample ```dart Not applicable ```

Screenshots or Video

Screenshots / Video demonstration Screenshot 2024-09-16 at 17 20 42

Logs

Logs ```console [Paste your logs here] ```

Flutter Doctor output

Doctor output ```console [✓] Flutter (Channel master, 3.26.0-1.0.pre.130, on macOS 14.6.1 23G93 darwin-arm64, locale en-RU) • Flutter version 3.26.0-1.0.pre.130 on channel master at /Users/samer/projects/flutter • Upstream repository git@github.com:flutter/flutter.git • Framework revision 93c8d00963 (5 hours ago), 2024-09-16 03:44:24 -0400 • Engine revision af4fe97fa1 • Dart version 3.6.0 (build 3.6.0-255.0.dev) • DevTools version 2.40.0-dev.1 [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) • Android SDK at /Users/samer/Library/Android/sdk • Platform android-35, build-tools 34.0.0 • Java binary at: /Users/samer/.sdkman/candidates/java/22.0.2-tem/bin/java • Java version OpenJDK Runtime Environment Temurin-22.0.2+9 (build 22.0.2+9) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 15.4) • Xcode at /Applications/Xcode-15.4.app/Contents/Developer • Build 15F31d • CocoaPods version 1.15.2 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 2024.1) • Android Studio at /Users/samer/Applications/Android Studio Koala Feature Drop 2024.1.2.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.11+0-17.0.11b1207.24-11852314) [!] Android Studio (version unknown) • Android Studio at /Users/samer/Applications/Android Studio Ladybug Feature Drop 2024.2.2 Canary 2.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 ✗ Unable to determine Android Studio version. • Java version OpenJDK Runtime Environment (build 21.0.3+-79915917-b509.11) [!] Android Studio (version unknown) • Android Studio at /Users/samer/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 ✗ Unable to determine Android Studio version. • Java version OpenJDK Runtime Environment (build 21.0.3+-79915917-b509.11) [✓] IntelliJ IDEA Ultimate Edition (version EAP IU-243.12818.47) • IntelliJ at /Users/samer/Applications/IntelliJ IDEA Ultimate.app • 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 [✓] VS Code (version 1.93.0) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.96.0 [✓] Connected device (5 available) • Михаил Новосельцев’s iPad (mobile) • 00008110-000A50AE11B9801E • ios • iOS 17.6.1 21G93 • iPhone (Михаил) (mobile) • 00008020-001254DA1E39002E • ios • iOS 17.6.1 21G93 • macOS (desktop) • macos • darwin-arm64 • macOS 14.6.1 23G93 darwin-arm64 • Mac Designed for iPad (desktop) • mac-designed-for-ipad • darwin • macOS 14.6.1 23G93 darwin-arm64 • Chrome (web) • chrome • web-javascript • Google Chrome 128.0.6613.120 [✓] Network resources • All expected network resources are available. ! Doctor found issues in 2 categories. ```
danagbemava-nc commented 1 month ago

Closing this as a duplicate of https://github.com/flutter/flutter/issues/121925

Sameri11 commented 1 month ago

@danagbemava-nc hi and thanks for your attention! Can you please elaborate, in which way this duplicates flutter/flutter#121925 ? From what I can see, in flutter/flutter#121925 bug is related to Android Studio version itself, not plugin versions, isn't it? As you can see in my actual output, Android Studio version determined correctly (and it's not even Preview version).

danagbemava-nc commented 1 month ago

@Sameri11 My apologies, this is what I saw in the doctor output that led me to the other issue

[!] Android Studio (version unknown)
    • Android Studio at /Users/samer/Applications/Android Studio Ladybug Feature Drop 2024.2.2 Canary 2.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
    ✗ Unable to determine Android Studio version.
    • Java version OpenJDK Runtime Environment (build 21.0.3+-79915917-b509.11)

I do see a similar output from my flutter doctor -v although I just installed in the plugins. For IntelliJ, the plugins are read properly on my system.

flutter doctor -v ``` [✓] Flutter (Channel stable, 3.24.3, on macOS 15.0 24A335 darwin-arm64, locale en-US) • Flutter version 3.24.3 on channel stable at /Users/deanli/dev/stable • Upstream repository https://github.com/flutter/flutter.git • Framework revision 2663184aa7 (5 days ago), 2024-09-11 16:27:48 -0500 • Engine revision 36335019a8 • Dart version 3.5.3 • DevTools version 2.37.3 [✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0) • Android SDK at /Users/deanli/Library/Android/sdk • Platform android-35, build-tools 35.0.0 • Java binary at: /Users/deanli/Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 17.0.11+0-17.0.11b1207.24-11852314) • All Android licenses accepted. [!] Xcode - develop for iOS and macOS (Xcode 16.0) • Xcode at /Applications/Xcode-16.0.0.app/Contents/Developer • Build 16A242d ! iOS 18.0 Simulator not installed; this may be necessary for iOS and macOS development. To download and install the platform, open Xcode, select Xcode > Settings > Platforms, and click the GET button for the required platform. For more information, please visit: https://developer.apple.com/documentation/xcode/installing-additional-simulator-runtimes • CocoaPods version 1.15.2 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 2024.1) • Android Studio at /Users/deanli/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.11+0-17.0.11b1207.24-11852314) [✓] IntelliJ IDEA Community Edition (version 2024.2.1) • IntelliJ at /Users/deanli/Applications/IntelliJ IDEA Community Edition.app • Flutter plugin version 81.1.3 • Dart plugin version 242.21829.3 [✓] VS Code (version 1.93.1) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.96.0 [✓] Connected device (5 available) • Nexus (mobile) • 00008020-001875E83A38002E • ios • iOS 17.7 21H16 • iPhone 15 Pro (mobile) • 94A113F0-E8F5-4810-9862-1EC0D82CB873 • ios • com.apple.CoreSimulator.SimRuntime.iOS-17-5 (simulator) • macOS (desktop) • macos • darwin-arm64 • macOS 15.0 24A335 darwin-arm64 • Mac Designed for iPad (desktop) • mac-designed-for-ipad • darwin • macOS 15.0 24A335 darwin-arm64 • Chrome (web) • chrome • web-javascript • Google Chrome 128.0.6613.138 [✓] Network resources • All expected network resources are available. ! Doctor found issues in 1 category. ``` ``` [!] Flutter (Channel master, 3.26.0-1.0.pre.141, on macOS 15.0 24A335 darwin-arm64, locale en-US) • Flutter version 3.26.0-1.0.pre.141 on channel master at /Users/deanli/dev/master • Upstream repository https://github.com/flutter/flutter.git • Framework revision c4c9f47c47 (61 minutes ago), 2024-09-17 01:27:11 -0400 • Engine revision 1376288f5c • Dart version 3.6.0 (build 3.6.0-255.0.dev) • DevTools version 2.40.0-dev.1 [✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0) • Android SDK at /Users/deanli/Library/Android/sdk • Platform android-35, build-tools 35.0.0 • Java binary at: /Users/deanli/Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 17.0.11+0-17.0.11b1207.24-11852314) • All Android licenses accepted. [!] Xcode - develop for iOS and macOS (Xcode 16.0) • Xcode at /Applications/Xcode-16.0.0.app/Contents/Developer • Build 16A242d ! iOS 18.0 Simulator not installed; this may be necessary for iOS and macOS development. To download and install the platform, open Xcode, select Xcode > Settings > Platforms, and click the GET button for the required platform. For more information, please visit: https://developer.apple.com/documentation/xcode/installing-additional-simulator-runtimes • CocoaPods version 1.15.2 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 2024.1) • Android Studio at /Users/deanli/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.11+0-17.0.11b1207.24-11852314) [✓] IntelliJ IDEA Community Edition (version 2024.2.1) • IntelliJ at /Users/deanli/Applications/IntelliJ IDEA Community Edition.app • Flutter plugin version 81.1.3 • Dart plugin version 242.21829.3 [✓] VS Code (version 1.93.1) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.96.0 [✓] Connected device (5 available) • Nexus (mobile) • 00008020-001875E83A38002E • ios • iOS 17.7 21H16 • iPhone 15 Pro (mobile) • 94A113F0-E8F5-4810-9862-1EC0D82CB873 • ios • com.apple.CoreSimulator.SimRuntime.iOS-17-5 (simulator) • macOS (desktop) • macos • darwin-arm64 • macOS 15.0 24A335 darwin-arm64 • Mac Designed for iPad (desktop) • mac-designed-for-ipad • darwin • macOS 15.0 24A335 darwin-arm64 • Chrome (web) • chrome • web-javascript • Google Chrome 128.0.6613.138 [✓] Network resources • All expected network resources are available. ! Doctor found issues in 2 categories. ```
Sameri11 commented 1 month ago

I think modern Android Studio changed path where plugins contained an Application Support, in this code: https://github.com/flutter/flutter/blob/c4c9f47c479da3786bb5d42e127597d6508fab50/packages/flutter_tools/lib/src/android/android_studio.dart#L75-L84

In this code,presetPluginsPath will be resolved to /Users/user/Library/Application Support/Google/AndroidStudio2024.1 in my environment, but plugins are in plugins dir inside this path. So, maybe it would be enough to add plugins here to path.

Another case is with Preview versions of studio – it doesn't have idea.paths.selector in Info.plist needed here, so fallback to this code: https://github.com/flutter/flutter/blob/c4c9f47c479da3786bb5d42e127597d6508fab50/packages/flutter_tools/lib/src/android/android_studio.dart#L185-L195

I guess this code also needs plugins to be added to path, but also here should be possible to lookup not only AndroidStudio$major.$minor dir, but also AndroidStudioPreview$major.$minor – preview versions have this path format now.

UPD: also, as @danagbemava-nc said that plugins in IntelliJ displayed correctly, intellij_validator has plugins in it's path: https://github.com/flutter/flutter/blob/master/packages/flutter_tools/lib/src/intellij/intellij_validator.dart#L559