Search code examples
androidc++android-ndkreact-native

React-Native android NDK


App middle native Player(C++) built with NDK 13b version and uses libgnustl-shared.so build with it. React native uses a different version of NDK and libgnustl-shared.so comes with it(NDK 10e version) has conflicts with the one I use for my middleware libs. Is there a way I can resolve this? the lib used for the app is not accepted by react-native and the react-native-based lib is not compatible with my middleware libs. I can not downgrade the NDK used for my native app (to 10e supported for react-native). Any help is appreciated.


Solution

  • The most correct way would be to refer the same version of library across all of the application. But if it is impossible - you may link one module against static version of library while leaving the second one linked against shared as usual.

    But such approach is rather a workaround than a real solution. Because there are at least next downsides:

    • app size bloates because now you are deploying code for two versions of library instead of one
    • objects of the same classes in different library versions may be binary incompatible - so if you try to pass c++ objects between code that relies on different lib version - it ends up with undefined behavior.

    At the end: I'd think twice if there is really no way to use the same version everywhere.