skip to Main Content

I have Flutter mobile app with Firebase. Today every time I run the "Flutter run" command on real iPhone 14 Pro mobile device, I see the following error. That was never the case before.

Could not build the precompiled application for the device.
Error (Xcode): Undefined symbol: leveldb::WriteBatch::Put(leveldb::Slice const&, leveldb::Slice const&)


Error (Xcode): Undefined symbol: leveldb::WriteBatch::Delete(leveldb::Slice const&)


Error (Xcode): Undefined symbol: leveldb::WriteBatch::WriteBatch()


Error (Xcode): Undefined symbol: leveldb::WriteBatch::~WriteBatch()


Error (Xcode): Undefined symbol: leveldb::DB::Open(leveldb::Options const&, std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> > const&, leveldb::DB**)


Error (Xcode): Undefined symbol: leveldb::Status::Status(leveldb::Status::Code, leveldb::Slice const&,
leveldb::Slice const&)


Error (Xcode): Undefined symbol: leveldb::Options::Options()


Error (Xcode): Undefined symbol: leveldb::Status::ToString() const

Does anyone know what might be the problem?

Here is how my pubspec.yaml file looks like:

version: 1.1.1+18
publish_to: none

environment:
  sdk: '>=2.18.6 <3.0.0'
  flutter: 3.3.8

dependencies:
  android_id: ^0.1.3+1
  badges: ^2.0.3
  cached_network_image: ^3.2.3
  carousel_slider: ^4.2.0
  cloud_firestore: ^4.2.0
  cloud_functions: ^4.0.6
  connectivity_plus: ^3.0.2
  device_info_plus: ^8.0.0
  dotted_border: ^2.0.0+3
  firebase_app_check: ^0.1.1+6
  firebase_auth: ^4.1.5
  firebase_core: ^2.3.0
  firebase_dynamic_links: ^5.0.8
  firebase_messaging: ^14.1.4
  firebase_remote_config: ^3.0.7
  firebase_storage: ^11.0.7
  firebase_ui_firestore: ^1.1.1
  flash: ^2.0.5
  flutter:
    sdk: flutter
  flutter_dotenv: ^5.0.2
  flutter_facebook_auth: 4.4.1
  flutter_hooks: ^0.18.5+1
  flutter_image_compress: ^1.1.3
  flutter_launcher_icons: ^0.11.0
  flutter_local_notifications: ^13.0.0
  flutter_localizations:
    sdk: flutter
  flutter_slidable: ^2.0.0
  flutter_svg: ^1.1.6
  geocoding: ^2.0.5
  geolocator: ^9.0.2
  google_fonts: ^3.0.1
  google_sign_in: ^5.4.2
  hooks_riverpod: ^2.1.1
  http: ^0.13.5
  image_cropper: ^3.0.1
  image_picker: ^0.8.6
  intl: ^0.17.0
  linkable: ^3.0.1
  material_design_icons_flutter: ^6.0.7096
  open_mail_app: ^0.4.5
  package_info_plus: ^3.0.2
  path_provider: ^2.0.11
  pattern_formatter: ^2.0.0
  permission_handler: ^10.2.0
  photo_view: ^0.14.0
  purchases_flutter: ^4.5.0
  rate_my_app: ^1.1.3
  share_plus: ^6.3.0
  shared_preferences: ^2.0.15
  shimmer: ^2.0.0
  store_redirect: ^2.0.1
  timeago: ^3.3.0
  tuple: ^2.0.1
  url_launcher: ^6.1.7
  uuid: ^3.0.7
  webview_flutter: ^4.0.0

dev_dependencies:
  flutter_test:
    sdk: flutter
  mocktail: ^0.3.0
  very_good_analysis: ^3.1.0

flutter:
  uses-material-design: true
  generate: true
  assets:
    - assets/envs/
    - assets/email_icons/
    - assets/flags/
    - assets/images/
    - assets/json/
    - assets/social_icons/

Please let me know to overcome this error.

2

Answers


  1. Chosen as BEST ANSWER

    I found the solution over here. I changed this block in my Podfile "target 'Runner' do". This is how the block looks:

    target 'Runner' do
      use_frameworks!
      use_modular_headers!
    
      # use this line
      pod 'FirebaseFirestore/WithLeveldb', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :tag => '10.3.0'
    
      # not this line
      # pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :tag => '10.3.0'
    
      flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
    end
    

    The commented line is what I had before. I basically changed "FirebaseFirestore" to "FirebaseFirestore/WithLeveldb" as mentioned in the doc.

    I hope this helps someone.


  2. This steps are for the issue in flutter.

    This has to do directly with the versions that your packages have on the pods.xcodeproj file a quick way you can set this up is the following:

    run flutter clean then run flutter pub get.

    Once you do that, open your xcode project. It doesn’t matter if it was opened before, right click on IOS and clikc on the open in xcode.

    While it’s indexing go back to your console and do flutter run.

    When you get to have the error again. Head into xcode and look for this issue under the issues tab.

    issues tab on xcode with validate project settings

    As you can see, we are being recommended by xcode to update to the recommended setting on our Pods.xcodeproj file. once we click on it, we will see the following screen.

    Build recommended settings

    Last, click on perform changes and it will update the dependencies of the file.

    After this, you are all set, you can do flutter run and continue to code.

    Now, please keep in mind that if you run flutter clean again, you will recieve this error again and will have to redo the previous steps.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search