Properly loading libc++_shared.so in app with native plugins

I’m making a native plugin for android, and it is dependent on libc++_shared.

Currently in order to load libc++_shared in the apk, apparently I have to modify gradle launcher file and add this:

        externalNativeBuild {
            cmake {
                cppFlags ""
                arguments "-DANDROID_STL=c++_shared"
            }
        }

into defaultConfig section of “android” within launcherTemplate.gradle and on top of that libc++_shared.so has to be added to the project manually (I need to copy it from its original location within ndk into some sort of Plugins/Android folder and then I need to set target arch by hand).

I’d like to know if there’s a simpler way to do it.

1 Like

I’m also wondering about this. How can we avoid including libc++_shared.so in the native plugin? This is required because we have 2 different plugins that require libc++_shared.so but they can’t both include libc++_shared.so.