Command doesn't work after upgrade flutter

Viewed 33557

Due to min v1.5 sdk plugin needs, I use flutter upgrade, but since I can't use command ... I have bash command not found,

I tried manually download 1.5 sdk and replace previous folder, when I use flutter doctor He say I have 1.2.1 ... I tried to re-upgrade but I have this error :

Your flutter checkout has local changes that would be erased by upgrading. If you want to keep these changes, it is
recommended that you stash them via "git stash" or else commit the changes to a local branch. If it is okay to remove
local changes, then re-run this command with --force.




C:\Users\utilisateur>flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, v1.2.1, on Microsoft Windows [version 10.0.17134.829], locale fr-FR)
[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[√] Android Studio (version 3.3)
[!] VS Code, 64-bit edition (version 1.21.1)
    X Flutter extension not installed; install from
      https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[√] Connected device (1 available)

! Doctor found issues in 1 category.

I tried git clean -xfd

i have ...

C:\Users\utilisateur>git clean -xfd
Unlink of file '.AndroidStudio3.3/config/plugins/Dart/lib/Dart.jar' failed. Should I try again?
(y/n) Sorry, I did not understand your answer. Please type 'y' or 'n'
Unlink of file '.AndroidStudio3.3/config/plugins/Dart/lib/Dart.jar' failed. Should I try again? (y/ngit stash save --keep-index
) Sorry, I did not understand your answer. Please type 'y' or 'n'
Unlink of file '.AndroidStudio3.3/config/plugins/Dart/lib/Dart.jar' failed. Should I try againgit stash save --keep-index
? (y/n) Sorry, I did not understand your answer. Please type 'y' or 'n'
Unlink of file '.AndroidStudio3.3/config/plugins/Dart/lib/Dart.jar' failed. Should I try again? git stash save --keep-index
(y/n) Sorry, I did not understand your answer. Please type 'y' or 'n'
Unlink of file '.AndroidStudio3.3/config/plugins/Dart/lib/Dart.jar' failed. Should I try again? (y/n)
6 Answers

In my case Flutter had unstaged changes (since it uses git), so I needed to stash or reset it to be able to upgrade it.

Go to flutter's path and:

# cd flutter_path/
git add -A
git reset --hard

Alternatively, you can use --force to upgrade it anyway.

flutter upgrade --force

Open your Terminal in Android Studio or CMD and Paste it

flutter upgrade --force

To make things simple can you extract the flutter sdk into folder 'c:\Flutter' Then set the path

Windows | iOS

Delete the old Flutter SDK folder you created. Then follow the steps illustrated here to point Android Studio to the new Flutter SDK installation. enter image description here

I encountered the same problem. This probably occurred because I have my flutter SDK installed in the E:\ directory rather than default C:\ directory. This is how I solved it,

1: Check where your Flutter Sdk is present. You can do this by creating a "New project->Flutter->Flutter Sdk" (This works if you have the flutter Sdk installed and configured, If you don't have it installed you can click on install Sdk option in the same "new Project->Flutter" window).

2: Then open Terminal by going to bottom right corner of you IDE and then clicking on terminal.

3: Change your directory to the flutter sdk's bin location by Typing "cd _yourSdkLocation\bin". Here replace "_yourSdkLocation" with the directory address where your flutter Sdk is present.

4: Then run "flutter upgrade --force"

In Terminal, use command

  • source .bash_profile
    
  • and then run ,
    flutter upgrade --force
    

To remove changes in flutter directory, It will upgrade to recent flutter version

  1. Press Windows+R to open the Run window.

  2. Type cmd into the box.

  3. Press Ctrl+Shift+Enter.

    C:\>choco upgrade dart-sdk
    

Note: Make sure you open cmd with Admin permission

Related