Encountered error while building for device - flutter Encountered error while building for device - flutter dart dart

Encountered error while building for device - flutter


Jimmy Anderson after running flutter upgrade, with the existing project you need to check the dependencies used if they are up to date too.

I had the same error with version 1.20.1 and the solution was to delete the Pods folder, the pubspec.lock file:

): Clean completely all points to links:

flutter cleanrm -Rf ios/Podsrm -Rf ios/.symlinksrm -Rf ios/Flutter/Flutter.frameworkrm -Rf ios/Flutter/Flutter.podspec

): Finally run these:

rm ios/Podfilerm pubspec.lockflutter run

If anyone has an up-to-date answer can complete this temporary solution.


Those steps worked for me:

  1. Run flutter build
  2. Open Xcode (Runner.xcworkspace)
  3. Go to Product -> Clean Build Folder
  4. Run on a real Device
  5. Then try again - flutter build ios


These steps helped me to resolve a similar issue

  1. At first try to take an Android build by following these steps
  • Delete pubspec.lock file
  • flutter clean ( inside ur project directory )
  • flutter pub get
  • flutter build apk --release

I then saw my Android build fail, it was some dependency related issues and I fixed those. Then repeated the above step 1. After that my Android build was successful.

  1. Then try to take the iOS build by following these steps
  • Deleted Pods folder inside the ios directory
  • Deleted the Podfile.lock file inside the ios directory
  • cd ios
  • pod install
  • pod update
  • cd ..
  • flutter clean
  • flutter pub get
  • flutter build ios --release

And then my iOS build was successfull