How to make Android native plugin working with Unity 4.5

We have a static library .so which is an Android native plugin for Unity.

With Unity 4.3.2, it was working perfectly on recent Android releases.

However, with the new Unit 4.5, it works only very recent Android versions (> 4.2 Jelly Bean).

Here is what the logcat says:

    D/Unity   (22271): Unable to lookup library path for 'libname', native render plugin support disabled.
    
    E/Unity   (22271): Unable to find libname

What is strange is that this message appears on both working (>4.2) and not working (<4.2) Android versions.

Thanks for your answer!

I think the problem is that you have named your library incorrectly where you refer to it in the C#.

If your library is called libfoo.so, you should refer to it with DllImport simply as:

[DllImport("foo")]

rather than

[DllImport("libfoo")]

I think that in Android 4.2 or 4.3 they must have made the dll loading more tolerant of people putting ‘lib’ in the front, so the code works in recent versions, but doesn’t in older ones.