androidc++pluginsunity-game-enginedllnotfoundexception

Unity3d Android plugin issues


I am getting a DllNotFoundException while trying to access my shared library from the Unity Android player. I placed the .so file in the Assets->Plugins->Android folder that the article HERE told me to. I ran adb logcat and watched the logs and here is a snippet of the error:

E/        (  532): inv_get_mag_rate
E/        (  532): inv_get_mag_rate
D/dalvikvm(27320): Trying to load lib /data/data/com.pheenixstudios.tankraigearena/lib/libwinsocklib.so 0x419ccfd0
E/Unity   (27320): Unable to find winsocklib
D/dalvikvm(27320): Trying to load lib /data/data/com.pheenixstudios.tankraigearena/lib/libwinsocklib.so 0x419ccfd0
E/Unity   (27320): Unable to find winsocklib
D/dalvikvm(27320): Trying to load lib /data/data/com.pheenixstudios.tankraigearena/lib/libwinsocklib.so 0x419ccfd0
E/Unity   (27320): Unable to find winsocklib
E/        (  532): inv_get_mag_rate
E/        (  532): inv_get_mag_rate
E/        (  532): inv_get_mag_rate
E/        (  532): inv_get_mag_rate
E/        (  532): inv_get_mag_rate
E/        (  532): inv_get_mag_rate
E/        (  532): inv_get_mag_rate
E/        (  532): inv_get_mag_rate
E/        (  532): inv_get_mag_rate
E/        (  532): inv_get_mag_rate
E/        (  532): inv_get_mag_rate
E/        (  532): inv_get_mag_rate
E/        (  532): inv_get_mag_rate
E/        (  532): inv_get_mag_rate
E/        (  532): inv_get_mag_rate
E/        (  532): inv_get_mag_rate
E/        (  532): inv_get_mag_rate
E/        (  532): inv_get_mag_rate
E/        (  532): inv_get_mag_rate
I/Unity   (27320): DllNotFoundException: winsocklib
I/Unity   (27320):   at (wrapper managed-to-native) NetworkFunctions:dllInit ()
I/Unity   (27320):   at AndroidNetworkController.Start () [0x00000] in <filename unknown>:0

I extracted the built APK and the winsocklib.so file is in the lib\armeabi-v7a folder. it is correctly spelled. I even tried appending lib to the filename to no avail.

Here is the C# code just for additional context:

[DllImport("winsocklib", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dllInit")]
public static extern Double dllInit();

I also simplified it to:

[DllImport("winsocklib")]
public static extern Double dllInit();

In addition, i made a copy and placed it in Assets->Plugins as well. I also tried renaming both to libwinsocklib without changing the c# code. Still the same exception.

Does anyone have any ideas? Can anyone shed some light on the situation?


Solution

  • Figured out the issue. I was using a lib build with Linux ABIs, not Android ABIs. The lib now works.