25

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)
Matteo
  • 2,256
  • 26
  • 42
Nitneuq
  • 3,866
  • 13
  • 41
  • 64
  • Can you try the following https://github.com/flutter/flutter/wiki/Workarounds-for-common-issues#flutter-installation-corrupted – F-1 Jun 20 '19 at 08:08
  • I can't, other error .. – Nitneuq Jun 20 '19 at 08:14
  • 1
    to make things simple can you extract the flutter sdk into folder 'c:\Flutter' Then open this folder in command prompt and try again – F-1 Jun 20 '19 at 08:16
  • done I change also the env variable C:\flutter\bin – Nitneuq Jun 20 '19 at 08:21
  • 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. – Nitneuq Jun 20 '19 at 08:46
  • 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 ? – Nitneuq Jun 20 '19 at 08:49
  • 1
    Might only be possible with new projects. Try this https://stackoverflow.com/a/55743938/469335 – F-1 Jun 20 '19 at 08:58
  • 1
    I have create new projet it's ok now, thank you for the help – Nitneuq Jun 20 '19 at 09:05
  • You are welcome. I've collated the steps into an answer, please mark it as the answer. – F-1 Jun 20 '19 at 09:15

7 Answers7

35

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
Mahdi-Malv
  • 16,677
  • 10
  • 70
  • 117
20

Open your Terminal in Android Studio or CMD and Paste it

flutter upgrade --force
Dharman
  • 30,962
  • 25
  • 85
  • 135
Muhammad Ashraf
  • 3,323
  • 2
  • 12
  • 19
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

F-1
  • 2,887
  • 20
  • 28
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"

Dharman
  • 30,962
  • 25
  • 85
  • 135
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

cursorrux
  • 1,382
  • 4
  • 9
  • 20
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

0

Open your Terminal in Android Studio or CMD and Paste it

flutter upgrade --force