Flutter Plugin project could not find C++ libraries

92 views Asked by At

TL;DR; Flutter Plugin project which uses .framework as iOS library, could not locate some of cpp libraries such as <list>

I am working on a Flutter Application which contains platform native code in it. Platform native code, both ios and android, is using the same library which is C++ based. The only difference is library import ways. For android platform library is added as .aar file, for iOS platform library is added as .framework file.

I decided to add my application into native android (java) and ios application (swift). After a short investigation,I found that I need two things;

  • Flutter Module project : To Integrate the application into a mobile app
  • Flutter Plugin project : To use my custom library in a module project.

I created both and ran successfully on android without any error. However, on the ios platform, the module project could not find some of c++ libraries such as <list>.

..../customLibrary.framework/Headers/xyz.hpp:XX:YY 'list' file not found

I've already added several c++ definitions in the .podspec file but it did not work.

 s.library = 'c++' s.xcconfig = { 
    'CLANG_CXX_LANGUAGE_STANDARD' => 'c++11', 
    'CLANG_CXX_LIBRARY' => 'libc++' 
}

And I could not port the libraries as plugin:ffi. Because .aar file contains java and .framework file .mm files in it.

How can I add cpp dependency to my Flutter Module project or Flutter Plugin project?

0

There are 0 answers