Command doesn't work after upgrade flutter
Asked Answered
P

6

26

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)
Placid answered 20/6, 2019 at 8:1 Comment(9)
Can you try the following github.com/flutter/flutter/wiki/…Ube
I can't, other error ..Placid
to make things simple can you extract the flutter sdk into folder 'c:\Flutter' Then open this folder in command prompt and try againUbe
done I change also the env variable C:\flutter\binPlacid
flutter doctor is ok 1.5 but it's now android studio .. I have change the path of flutter sdk but I have Warning! This package referenced a Flutter repository via the .packages file that is no longer available. The repository from which the 'flutter' tool is currently executing will be used instead. running Flutter tool: C:\flutter previous reference : C:\Users\utilisateur\flutter This can happen if you deleted or moved your copy of the Flutter repository, or if it was on a volume that is no longer mounted or has been mounted at a different location.Placid
I think it's because at the creation of the projet I add sdk path, but now it change, it's possible to change this if it's this ?Placid
Might only be possible with new projects. Try this https://mcmap.net/q/127363/-how-to-find-the-path-of-flutter-sdkUbe
I have create new projet it's ok now, thank you for the helpPlacid
You are welcome. I've collated the steps into an answer, please mark it as the answer.Ube
U
3

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

Ube answered 20/6, 2019 at 9:12 Comment(0)
C
38

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
Collapse answered 28/7, 2019 at 9:52 Comment(1)
you need to go to flutter path on your device and run this commands to upgrade .Heimlich
S
20

Open your Terminal in Android Studio or CMD and Paste it

flutter upgrade --force
Staceystaci answered 26/11, 2019 at 14:31 Comment(0)
U
3

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

Ube answered 20/6, 2019 at 9:12 Comment(0)
S
3

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"

Sushi answered 17/11, 2019 at 5:26 Comment(0)
L
1

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

Liebman answered 28/9, 2021 at 3:16 Comment(0)
S
1
  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

Sheela answered 12/2, 2022 at 14:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.