Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

armeabi and x86 native shared library

Discussion in 'Android' started by elias_t, Dec 4, 2014.

  1. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,366
    I have a shared library (.so) which is compiled for armeabi and x86 platforms.

    Since unity is supporting now the fat deployment (arm + x86), how can I tell unity which shared library to use?
     
  2. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,366
    The only workaround I found so far is:

    include both plugins, get the processor info. If the processor is x86 call the x86 imported functions, other wise the armeabi ones.
     
  3. bitter

    bitter

    Unity Technologies

    Joined:
    Jan 11, 2012
    Posts:
    530
    Just stick the library in the correct subfolder. We follow the standard Android library structure. Meaning arm libraries goes into armeabi-v7a and x86 libraries in the x86 folder.
     
  4. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,366
    Well I tried this already but it doesn't work.

    I placed them: Plugins/Android/armeabi-v7a
    Plugins/Android/x86

    and do not get included in the apk.

    also : Plugins/armeabi-v7a
    Plugins/x86

    do not work either.

    I am using the latest unity 4.6
     
  5. bitter

    bitter

    Unity Technologies

    Joined:
    Jan 11, 2012
    Posts:
    530
    Try
    Plugins/Android/libs/armeabi-v7a
    Plugins/Android/libs/x86
     
    litafk likes this.
  6. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,366
    Ok, this worked! Thanks.

    Perhaps the documentation should be updated regarding this matter.
     
  7. SCS_Dani

    SCS_Dani

    Joined:
    May 28, 2012
    Posts:
    55
    We are trying to use a plugin in Unity 5 beta that also includes libs for:

    - mips
    - mips64
    - arm64-v8a
    - armeabi
    - x86_64

    How can I specify that differences? I get the duplicate error (and I have no MIPS option).
     
  8. bitter

    bitter

    Unity Technologies

    Joined:
    Jan 11, 2012
    Posts:
    530
    Ah, never actually thought about that. Since we don't support those architectures I guess you have to tag those libraries as non-android libraries to exclude them from the build.
     
  9. SCS_Dani

    SCS_Dani

    Joined:
    May 28, 2012
    Posts:
    55
    Ahhh ok! But did it work in Unity 4? This is the plugin: https://www.assetstore.unity3d.com/en/#!/content/10032

    Btw: Thanks for your quick answer! ;)
     
  10. bitter

    bitter

    Unity Technologies

    Joined:
    Jan 11, 2012
    Posts:
    530
    Yes, it should work in Unity 4. Unity 4 will ignore any folders that are not armeabi* or x86.
     
  11. almo

    almo

    Joined:
    Jul 14, 2010
    Posts:
    83
    Last edited: Apr 28, 2015
  12. VReel

    VReel

    Joined:
    Nov 22, 2016
    Posts:
    1
    This thread helped us to ensure we were putting plugins in the right folder for Android - ie. "Plugins/Android/libs" from @bitter's post.

    But for future reference it may be worth noting that having library names with a hyphen character (and possibly other special characters) don't seem to be recognised by Unity.

    In particular, we were using Android Studio's default "libnative-lib.so" that you get when you create a standard project that "Includes C++ support", but Unity didn't recognise it as a plugin, it was only when renaming it to "libnative.so" that it worked.