Flutter Ignoring ffi-1.12.2 because its extensions are not built. Try: gem pristine ffi --version 1.12.2
Asked Answered
M

3

18

When i try to build Flutter project to IOS it show me this error, I have tried to clean and also tried to change the directory of the project.

Launching lib/main.dart on iPhone 12 Pro Max in debug mode... Running pod install... CocoaPods' output: ↳

    [!] Invalid `Podfile` file: [!] Specifying multiple `post_install` hooks is unsupported..

     #  from /Users/eapple/Downloads/codecanyon-IRJuYEQd-delivery-boy-for-multirestaurants-flutter-app/flutter_application/ios/Podfile:43
     #  -------------------------------------------
     #  
     >  post_install do |installer|
     #    installer.pods_project.targets.each do |target|
     #  -------------------------------------------

    /Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.9.1/lib/cocoapods-core/podfile.rb:301:in `rescue in block in from_ruby'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.9.1/lib/cocoapods-core/podfile.rb:295:in `block in from_ruby'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.9.1/lib/cocoapods-core/podfile.rb:50:in `instance_eval'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.9.1/lib/cocoapods-core/podfile.rb:50:in `initialize'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.9.1/lib/cocoapods-core/podfile.rb:293:in `new'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.9.1/lib/cocoapods-core/podfile.rb:293:in `from_ruby'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.9.1/lib/cocoapods-core/podfile.rb:259:in `from_file'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/config.rb:200:in `podfile'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/command.rb:150:in `verify_podfile_exists!'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/command/install.rb:46:in `run'
    /Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/lib/cocoapods/command.rb:52:in `run'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.1/bin/pod:55:in `<top (required)>'
    /usr/local/bin/pod:23:in `load'
    /usr/local/bin/pod:23:in `<main>'

Error output from CocoaPods: ↳
    Ignoring ffi-1.12.2 because its extensions are not built. Try: gem pristine ffi --version 1.12.2
Error running pod install
Error launching application on iPhone 12 Pro Max.

Here is the pubspec.yaml file

  cupertino_icons: 0.1.2
  google_maps_flutter: 0.5.27
  mvc_pattern: 5.1.1
  global_configuration: 1.5.0
  http: 0.12.1
  html: 0.14.0+3
  shared_preferences: 0.5.7
  flutter_html: 0.11.1
  location: 3.0.2
  url_launcher: 5.4.5
  firebase_messaging: 6.0.13
  cached_network_image: 2.2.0
  fluttertoast: 4.0.1

Things I have tried, from common sense and various other Stack questions:

  • flutter clean

  • Adding this to ios/Podfile

    post_install do |installer|
        installer.pods_project.targets.each do |target|
          target.build_configurations.each do |config|
            config.build_settings['SWIFT_VERSION'] = '4.0'
           end
         end
      end
    
  • flutter pub get

  • installing gem install ffi --version 1.13.1 --user-install

Motte answered 21/12, 2020 at 5:2 Comment(4)
See my biteinteractive.com/how-to-get-started-with-pods. You need to stop using the system ruby and install your own.Thorley
Hi Umer, have you tried uncommenting the line platform: iOS, '9.0' on your PodfileCistaceous
Yes i tried but it arise new errorMotte
use CocoaPods and gem install ffi againRepercussion
D
2

Update: you might not need to do this anymore, depending on the version you're working on if you have this issue follow the next steps but you might be in a better position just following the installation process from the official website.

https://docs.flutter.dev/get-started/install/macos

Old solution: On the Flutter official site when installing flutter they tell you to run this command if you're using apple sillicon.

Deprecated: the website doesn't include this note anymore. enter image description here

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

You could also delete your ios/Podfile and ios/Podfile.lock

then run

flutter clean && flutter pub get && flutter run

just remember to connect your device or run it on the simulator open.

Dorey answered 23/7, 2022 at 20:4 Comment(1)
if it keeps getting error check your dependencies you probably have an incompatible dependency on your pubspeck.yaml, that's why you must check which message does it tell you after the command flutter run is executed it.Dorey
H
1

I suggest try running gem pristine ffi --version 1.12.2 as mentioned in the logs and see if it works. This issue seems to be similar to this existing Stack Overflow post.

Holpen answered 17/5, 2021 at 13:28 Comment(0)
E
0

if your computer is using M1 or M2 processors then I suggest you try the following:

sudo arch -x86_64 gem install ffi

arch -x86_64 pod install
Efface answered 6/7, 2022 at 14:1 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.