Winter Winter Winter Winter - 9 months ago 39
Android Question

How to reference .so library in visual studio cross platform android project?

I'm familiar with C# projects, did cross platform development with Xamarin before.

I'm trying to reuse a .so library in a visual studio cross platform android project (Mono C#)? Is this possible?

Don't even know where to start. Any suggestions welcome.

Thanks in advance.


Yes, it is possible. With Xamarin.Android, you can bundle native libraries into the .apk.

To actually call the code, you need to create a DllImport function declaration for the existing code to invoke. Everything else is handled by the runtime for you.

private static extern int someMethod();

Further reading: Using native libraries and Interop with Native Libraries