leoafarias / fvm

Flutter Version Management: A simple CLI to manage Flutter SDK versions.
https://fvm.app
MIT License
4.43k stars 213 forks source link

SDK Path does not point to the project directory. "fvm use" will not make IntelliJ (Android Studio, ...) switch Flutter version. Please consult documentation. #724

Open Haidar0096 opened 1 month ago

Haidar0096 commented 1 month ago

IDEs: ┌────────────────────────────────┬────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ │ IDEs │ Value │ ├────────────────────────────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ │ VSCode │ │ ├────────────────────────────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ │ dart.flutterSdkPath │ .fvm/versions/stable │ ├────────────────────────────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ │ Matches pinned version: │ true │ ├────────────────────────────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ │ IntelliJ (Android Studio, ...) │ │ ├────────────────────────────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ │ flutter.sdk │ /Users/haidarmehsen/fvm/versions/stable │ ├────────────────────────────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ │ Matches pinned version: │ true │ ├────────────────────────────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ │ SDK Path │ SDK Path does not point to the project directory. "fvm use" will not make IntelliJ (Android Studio, ...) switch Flutter version. Please consult documentation. │ └────────────────────────────────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

Environment: ┌────────────────────────┬─────────────────────────────────────────────┐ │ Environment Variables │ Value │ ├────────────────────────┼─────────────────────────────────────────────┤ │ Flutter PATH │ /Users/haidarmehsen/fvm/default/bin/flutter │ ├────────────────────────┼─────────────────────────────────────────────┤ │ Dart PATH │ /Users/haidarmehsen/fvm/default/bin/dart │ ├────────────────────────┼─────────────────────────────────────────────┤ │ FVM_CACHE_PATH │ N/A │ ├────────────────────────┼─────────────────────────────────────────────┤ │ FVM_USE_GIT_CACHE │ N/A │ ├────────────────────────┼─────────────────────────────────────────────┤ │ FVM_GIT_CACHE_PATH │ N/A │ ├────────────────────────┼─────────────────────────────────────────────┤ │ FVM_FLUTTER_URL │ N/A │ ├────────────────────────┼─────────────────────────────────────────────┤ │ FVM_PRIVILEDGED_ACCESS │ N/A │ ├────────────────────────┼─────────────────────────────────────────────┤ │ Flutter PATH │ /Users/haidarmehsen/fvm/default/bin/flutter │ ├────────────────────────┼─────────────────────────────────────────────┤ │ Dart PATH │ /Users/haidarmehsen/fvm/default/bin/dart │ └────────────────────────┴─────────────────────────────────────────────┘ ┌──────────────┬──────────────────────────────────────────────────────────────────┐ │ Platform │ Value │ ├──────────────┼──────────────────────────────────────────────────────────────────┤ │ OS │ macos Version 14.5 (Build 23F79) │ ├──────────────┼──────────────────────────────────────────────────────────────────┤ │ Dart Locale │ en-LB │ ├──────────────┼──────────────────────────────────────────────────────────────────┤ │ Dart runtime │ 3.2.6 (stable) (Wed Jan 24 13:41:58 2024 +0000) on "macos_arm64" │ └──────────────┴──────────────────────────────────────────────────────────────────┘



Why am I getting? How do I solve it?
> SDK Path does not point to the project directory. "fvm use" will not make IntelliJ (Android Studio, ...) switch Flutter version. >Please consult documentation.
twogood commented 1 month ago

It's not a bug, you need to manually change the Flutter SDK path in the Android Studio settings. Picture from https://cshanjib.medium.com/setting-up-fvm-flutter-version-management-properly-ab45ade0dd55 inserted below:

image

Haidar0096 commented 1 month ago

It's not a bug, you need to manually change the Flutter SDK path in the Android Studio settings. Picture from https://cshanjib.medium.com/setting-up-fvm-flutter-version-management-properly-ab45ade0dd55 inserted below:

image

Its already set, then why I get this message from fvm doctor?

SDK Path does not point to the project directory. "fvm use" will not make IntelliJ (Android Studio, ...) switch Flutter version. Please consult documentation.
twogood commented 1 month ago

Ok, that sounds like a bug!

digoreis commented 4 weeks ago

Based on what we see in your project, the necessary file to verify this configuration wasn't found. There are two files used in the IntelliJ test:

{project}/android/local.properties
{project}/.idea/libraries/Dart_SDK.xml

The issue is that in the second file, the path you provided does not correctly configure the project directory.

You can learn more about the reason for this message in the command file here:
https://github.com/leoafarias/fvm/blob/67672d93a1989155c6e469a6b5353b3e88ce8438/lib/src/commands/doctor_command.dart#L144