- Home /
Native plugin JNI_OnLoad/UnitySetGraphicsDevice not called when using IL2CPP on Android
I'm one of the developers of NoesisGUI and we are having trouble making our asset work with IL2CPP under Android.
NoesisGUI asset uses a native plugin that is placed under Assets/Plugins/Android. When used normally (Mono2x) the library is loaded correctly and both JNI_OnLoad and UnitySetGraphicsDevice (for low-level native rendering) are called:
D dalvikvm: Trying to load lib /mnt/asec/com.noesis.test/lib/libNoesis.so
> D dalvikvm: Added shared lib /mnt/asec/com.noesis.test/lib/libNoesis.so
> JNI_OnLoad found and called
> UnitySetGraphicsDevice found and called with the correct DeviceType
When using IL2CPP, our library does not seem to load (no message is logged about it) and JNI_OnLoad and UnitySetGraphicsDevice are not being called. However, PInvoke funtions to our library are working.
We also noticed that a new library is being loaded when IL2CPP is activated:
D dalvikvm: Trying to load lib /mnt/asec/com.noesis.test/lib/libil2cpp.so
> D dalvikvm: Added shared lib /mnt/asec/com.noesis.test/lib/libil2cpp.so
> D dalvikvm: No JNI_OnLoad found in /mnt/asec/com.noesis.test/lib/libil2cpp.so, skipping init
Any idea if that is a known bug of IL2CPP under Android? Are native plugins (using low-level rendering api) supported in IL2CPP?
Thanks for your help.
This is not a known bug for IL2CPP with Android. Native plugins are supported though. Could you submit a bug report and let me know the bug number? We will have a look at correcting this.
Also, the libil2cpp.so library is the IL2CPP runtime library, so loading it is expected and correct.
Bug report number: 737959.
As explained in the bug report, I was able to reproduce this problem also with Unity RenderingPlugin example (version 4.5: http://docs.unity3d.com/es/current/uploads/Examples/RenderingPluginExample45.zip).
Excellent, thanks for the bug report. We will investigate it.