How to Solve If Flutter Upgrade Fail?

· 3 min read
How to Solve If Flutter Upgrade Fail
How to Solve If Flutter Upgrade Fail

When a user tries to upgrade a flutter it started throwing an error that states “your local changes to the following files would be overwritten by merge: examples/flutter_gallery/ios/Runner.xcodeproj/project. pbxproj“. So in today’s article, we will go through how to Solve If Flutter Upgrade Fail.

How to Solve If Flutter Upgrade Fail?

Go to your flutter home directory and do git checkout or git reset head –hard

In the flutter install directory please run

git clean -xfd
git stash save --keep-index
git stash drop
git pull
flutter doctor

Below worked with me to get 1.0.0-stable:

$ git clean -xfd
$ git checkout origin/stable
$ git pull
$ flutter doctor
$ flutter --version
Flutter 1.0.0 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 5391447fae (5 days ago) • 2018-11-29 19:41:26 -0800
Engine • revision 7375a0f414
Tools • Dart 2.1.0 (build 2.1.0-dev.9.4 f9ebf21297)

You need to rename flutter.gradle to anything e.g flutter. Gradle then runs the flutter upgrade command again.

The file is located at

C:\your_flutter_location\flutter_main_folder\packages\flutter_tools\gradle

This simply means that you have modified some file from the Flutter SDK, to know the modification navigate to the location where you have flutter SDK installed and enter the command git status and you will see the name of the files in red color that have been modified e.g for me it was dropdown.dart

flutter git
flutter git

You can remove those changes by adding it to stash by running the command git stash and now again when you run git status it should prompt you saying nothing to commit, working tree clean

And now you are good to run flutter upgrade and get your hands on the latest contributions from the flutter community.

In some cases: git reset –hard origin/beta in the flutter home directory fixed it. In my case git status revealed that “You have unmerged paths.

Note that for the stable branch you need this:

cd $FLUTTER_HOME    
git reset --hard origin/stable

Conclusion:

Thanks for Reading !!! Don’t forget to drop your feedback in the comments below right now!!!

So in this article, we have been through how to Solve If Flutter Upgrade Fail.

Keep Learning !!! Keep Fluttering !!!

FlutterAgency.com is our portal Platform dedicated to Flutter Technology and Flutter Developers. The portal is full of cool resources from Flutter like Flutter Widget GuideFlutter ProjectsCode libs and etc.

FlutterAgency.com is one of the most popular online portals dedicated to Flutter Technology and daily thousands of unique visitors come to this portal to enhance their knowledge of Flutter.

Leave a Reply