shrikanta mazumder
shrikanta mazumder

Reputation: 373

Can't build flutter project on macbook pro m1 due to podfile error

I am working on a flutter project which is built using flutter version 1.22. Recently I bought a MacBook m1. I am facing a worst-case that I couldn't build the project on MacBook. It's showing a long podfile error. This is happening for some firebase packages. Now I am totally stuck. Can not update my app which is live on App Store. If you have any idea or a solution, please help.

Upvotes: 1

Views: 1929

Answers (5)

Nguyễn Hồng Quang
Nguyễn Hồng Quang

Reputation: 189

Solution for Apple M1 silicon: Please try below commands:

sudo softwareupdate --install-rosetta --agree-to-license

sudo gem uninstall ffi && sudo gem install ffi -- --enable-libffi-alloc

Upvotes: 1

Daljeet
Daljeet

Reputation: 1595

Please try below commands on M1 machine:

sudo arch -x86_64 gem install ffi
arch -x86_64 pod install

Upvotes: 2

Afandi Yusuf
Afandi Yusuf

Reputation: 389

Well, I had this nightmare before. happen when I change and migrate flutter from 1.xx -> 2.xx

  1. Create a new flutter project with android studio with the same name and the same package.
  2. Copy the lib folder and package.YAML to the new project.
  3. run flutter builds ios, and try you still had an error or not.
  4. If not, that means this solution is working, start copying the native config of your project like firebase config, android manifest XML.

Upvotes: 0

Gpack
Gpack

Reputation: 2193

I had a similar thing happen to me and this is how I fixed it:

  1. rm ios/Podfile
  2. rm ios/Podfile.lock
  3. rm -rf ios/Pods
  4. flutter clean
  5. flutter pub get

Then if that doesn't work, make sure XCode is up to date, open ios/Runner.xcworkspace. You should see some warning on the left and a prompt asking you to apply the recommended changes.

Upvotes: 0

Related Questions