- Home /
Android native plugin question
Ok, I wrote an Android native code plugin following the instructions contained in http://docs.unity3d.com/Manual/PluginsForAndroid.html. The project has been published and has been on the store for months, so I don't have any doubt that everything is working. However, my attention was recently captured by a few log entries that seems to indicate that some inefficiency is involved. I'd like to know if the messages (and the potential inefficient that they may hide) can be removed.
The first time the plugin (called MyPlugin) is used, I get this message:
D/dalvikvm( 3523): Trying to load lib /data/app-lib/com.xxx.yyy-1/libMyPlugin.so 0x41e34110
D/dalvikvm( 3523): Added shared lib /data/app-lib/com.xxx.yyy-1/libMyPlugin.so 0x41e34110
So far so good, the shared library that implements the plugin is loaded. Unity has properly added the "lib" prefix and ".so", as described in the documentation. Then, the first surprise:
E/Unity ( 3523): Unable to find 'MyPlugin'
E/Unity ( 3523):
E/Unity ( 3523): (Filename: Line: 168)
E/Unity ( 3523):
WTF? You just loaded it, how can you not "find" it? What's that message for? Please consider that the plugin is working correctly, so despite the error message, Unity did find the plugin as is using it, yet it is complaining that it couldn't find it.
But it gets weirder. Each time the plugin is used after the first time, I get the following messages:
D/dalvikvm( 3523): Trying to load lib /data/app-lib/com.xxx.yyy-1/libMyPlugin.so 0x41e34110
D/dalvikvm( 3523): Shared lib '/data/app-lib/com.xxx.yyy-1/libMyPlugin.so' already loaded in same CL 0x41e34110
E/Unity ( 3523): Unable to find 'MyPlugin'
E/Unity ( 3523):
E/Unity ( 3523): (Filename: Line: 168)
E/Unity ( 3523):
So each and every time the plugin is invoked, Unity is going to the OS, requesting to load the library again and again. Of course, the OS reports that the library is already there, but Unity is still not able to "find" the plugin, yet the plugin is properly invoked.
Any idea about what's happening and how to avoid these messages?