Skip to content

Instantly share code, notes, and snippets.

@smitpatelx
Forked from minhcasi/Flutter Clean.md
Created April 17, 2022 09:47
Show Gist options
  • Save smitpatelx/b7f3c8e739a8417187bd773d1be06874 to your computer and use it in GitHub Desktop.
Save smitpatelx/b7f3c8e739a8417187bd773d1be06874 to your computer and use it in GitHub Desktop.
These are common issues on Flutter and solutions to fix

Quick Clean Cache

  1. Open android studio Tools->Flutter->Clean
  2. Go to File -> Invalidate Caches / Restart
  3. Or open terminal run "flutter clean"
  4. Remove pubspec.lock
  5. Double check the Flutter SDK Path config correcty - https://tppr.me/qn6dP

Or open the terminal and try this script:

flutter clean
flutter pub cache repair
flutter pub get

Rebuild the project again

Update Flutter to Channel Stable

  1. Open termimal on Mac or CommandLine on Window:
    flutter channel stable
    flutter upgrade --force
    
  2. Also run "flutter doctor" and fix all the issues
  3. Update the Flutter SDK Path from Android Studio - https://tppr.me/qn6dP

Fix build issue on iOS

  1. Remove following files and folders (see this screenshot - https://tppr.me/vwqX0 )

    - Go to ios: remove Pods folder, Podfile and fodfile.lock, .symlink folder (this folder is hidden)
    - remove build folder
    
  2. Open XCode, File > Workspace Settings > Select 'New Build System' - https://tppr.me/CRHLC

  3. Open terminal (at ios folder) and run:

    pod cache clean --all
    pod repo update
    pod install
    
    // if you are using Fluxstore try to run 
    pod update OneSignal
    
  4. Open Android Studio and run the green button - https://tppr.me/h3aTb

Fix build issue on Android

  1. Go to to android folder and run
// mac os
./gradlew clean

// window os
gradlew.bat clean
  1. Go to android folder and remove the .grade hidden folder
  2. Go the Android Studio and run the project again.

Issue: "Registered as a Git root, but no Git repositories were found there" or "This package referenced a Flutter repository via the .packages file that is no longer available."

Solution:

  1. Delete .packages file and .idea hidden folder.
  2. Run following command flutter pub get or click the Pub get when open Pubspec.yaml file on Android Studio

Xcode 11.4 changed the way frameworks are linked and embedded, and you may experience issues switching between iOS devices and simulators. Flutter v1.15.3 and later will automatically migrate your Xcode project

Please follow the guide from this link: https://flutter.dev/docs/development/ios-project-migration

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment