Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

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

Discussion in 'Android' started by neginfinity, Feb 16, 2022.

  1. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,593
    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:
    Code (csharp):
    1.  
    2.         externalNativeBuild {
    3.             cmake {
    4.                 cppFlags ""
    5.                 arguments "-DANDROID_STL=c++_shared"
    6.             }
    7.         }
    8.  
    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.
     
    the_unity_saga likes this.
  2. fdart

    fdart

    Joined:
    Jan 4, 2019
    Posts:
    17
    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.