Armeabi and x86 native shared library

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?

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.

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.

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

Try
Plugins/Android/libs/armeabi-v7a
Plugins/Android/libs/x86

1 Like

Ok, this worked! Thanks.

Perhaps the documentation should be updated regarding this matter.

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).

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.

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! :wink:

Yes, it should work in Unity 4. Unity 4 will ignore any folders that are not armeabi* or x86.

How do I include an android library now in Unity 5? Including it in Plugins and telling it it’s an android plugin just results in DllNotFoundException. I have an arm build and an x86 build.

More details here:

http://gamedev.stackexchange.com/questions/99167/how-do-i-refer-to-a-native-library-with-unity-5-on-android

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.