Could not install Flutter?

Could not install Flutter?

πŸ’‘
If you have trouble when installing the Flutter at the first time Following solutions could safe your days

11. Issue with MacOS 13 - Xcode 15 - iOS 17

Fix issue build with MacOS 13 - Xcode 15 - iOS 17
Solution
Follow the steps below:
  1. Update Xcode by following the instructions below: https://monosnap.com/file/wAtUmGguvGn1o5Iuabs6leTowv0Sps
  1. Upgrade library in pubspec.yaml:
flutter_inappwebview: git: url: https://github.com/vixez/flutter_inappwebview.git ref: fix-xcode-17
flutterwave_standard: git: url: https://github.com/inspireui/Flutterwave ref: fix-xcode-15
  1. run comment in terminal project:
rm -rf ios/Pods rm -f ios/Podfile.lock rm -f pubspec.lock rm -rf ios/.symlinks flutter clean flutter pub get cd ios && pod deintegrate && pod install && pod update && cd ..

10. Issue: please provide your purchase code in configs/env file

If you are having trouble building the FluxStore source code and are receiving a warning message that says "please provide your purchase code in configs/env.xx" try the following
Solution:
  • First, double check the envatoPurchaseCode located in the configs/env.props file and make sure it matches the license key file. You can find more information about where to locate your purchase code in this Where is My Purchase Code? article.
  • If you previously activated your license key on an old domain site and are now trying to run it on a new domain site, you may encounter issues. To resolve this, log in to your Wordpress site, go to MStore API, and select "Deactivate" next to the license key, or select "Deactivate" from the FluxBuilder app.
Β 

9. Command not found: flutter

Follow this guide:

8. Build issue on Android

Solution: go to android folder and run ./gradlew clean assembleDebug

7. CocoaPods not installed or not in valid state

❓
This error sometime happen when you upgrade the macOS version, then the visual studio or IntelliJ not able to find the path or associated plugin or extension.
notion image
Solution/Answer
  1. Run this script to reinstall the cocoapods, the restart the IDE or Editor
    1. sudo gem uninstall cocoapods && sudo gem install cocoapods
  1. Or, Reinstalling the flutter extension on visual code fixed this
  1. On Android Studio, "Invalidate Caches / Restart.."
  1. Refer to similar solution - https://stackoverflow.com/questions/62593939/cocoapods-not-installed-or-not-in-valid-state
If the solution does not work, please check solution #5 below

6. Some common question on latest Flutter

❓
6.1. - Getting many warning when build the app on XCode
Solution/Answer
  • Make sure to use latest Android SDK Command-line Tools
notion image
  • After install restart the Android Studio, and run pub get and flutter doctor

5. M1 Chip issue on MacOS πŸ”₯

❓
I could not build on my MacBook Pro or Mac Mini with Apple M1 Chip (use for first generate M1, M1 Pro, or M1 Max) due to the CocoaPods and Ruby version issues, for example: you could not run pod install from the ios folder
Solution 1 - using Cocoapods from brew
  • When running flutter doctor it return the Pod is not installing
    • βœ…Β Fixed by remove the Pod and reinstall by using brew
      # Uninstall the local cocoapods gem sudo gem uninstall cocoapods # Reinstall cocoapods via Homebrew brew install cocoapods
  • If the brew is not recognized (check brew version brew -v ) after install from https://brew.sh - edit the file vim .zshrc and make sure the Path is correct as below
    • // file .zshrc from user root folder (Users/[name]/.zshrc export PATH=/opt/homebrew/bin:$PATH export PATH=/Users/minh/flutter/bin:$PATH
Solution 2 - using ruby-install
Follow this guide to install latest Ruby 3.x
After install, you could check ruby version by run ruby -v
notion image
Then run sudo gem install cocoapods (this will install new Pod to match with new ruby version)
πŸ”₯
1. Run which pod and which ruby (copy the ruby path to paste to /usr/local/bin/pod file) to check if the pod and ruby is loaded from the correct path /Users/[name]/.rubies/ruby-3.1.1 2. You could also run sudo vim /usr/local/bin/pod to update the path for ruby - https://tppr.me/xDZCp instead of using default Pod from macOS
Β 
Β 
❓
Scroll jumping issue when scroll the app on M1 chip
Solution
Install Rosetta, ref this guide
sudo softwareupdate --install-rosetta --agree-to-license
Right Click XCode to Show Package Content > Content > Developer > Applications > Click Get Info and Check the Open using Rosetta
notion image

4. Missing 64 bit on XCode

❓
ERROR ITMS-90086: "Missing 64-bit support. iOS apps submitted to the App Store must include 64-bit support and be built with the iOS 8 SDK or later. We recommend using the default "Standard Architectures" build setting for "Architectures" in Xcode, to build a single binary with both 32-bit and 64-bit support.
Solution/Answer
This issues cause by not run the ios builder before Archive the app.
flutter run build ios /// then open XCode and archive the app
notion image

3. "Flutter/Flutter.h not found." on iOS.

❓
This issues sometime happen when switching the master channel ↔ stable channel, that cause mismatch Flutter Pod library..
Solutions/Answer
πŸ‘‰ 2.1 - Solution #1:
  1. RemoveΒ ios/Flutter/Flutter.podspec:Β rm ios/Flutter/Flutter.podspec
  1. flutter clean flutter pub cache repair
  1. Run your app again.

πŸ‘‰ 2.2 - Solution #1:
Created a new app with flutter create my_app, deleted everything from ios/Flutter in my own app and copied everything from my_app/ios/Flutter back again in my own app. You may see some difference on the Flutter.podspec
notion image

2. iOS Build failed

❓
bitcode bundle could not be generated because '.../ios/Flutter/Flutter.framework/Flutter' was built without full bitcode. All frameworks and dylibs for bitcode must be generated from Xcode Archive or Install build file '.../ios/Flutter/Flutter.framework/Flutter' for architecture armv7
Screenshot
notion image
Solution/Answer
Make sure to meet the requirements:
  • Use the latest XCode.
  • Pass all issues from flutter doctor
  • Run the project direct from Android Studio or VS Code, and make sure to run flutter pub get
  • Clean Pod cache:
    • Remove the following files and folders, see screenshot
    • Go to iOS folder: remove Pods folder, .symlink (hidden folder), build folder, Podfile.lock file.
    • Open terminal (at iOS folder) and run:
      • pod cache clean --all pod deintegrate pod repo update pod update pod install
        Β 

1. VS Code Problem

❓
When running the VS Code, you could not run the Flutter project
Screenshot
notion image
Solution/Answer
This issues cause by Flutter cache, just simple clean up the cache
flutter clean // restart the VS Code, then run flutter pub get
Β 
Β