I compiled libTestGame.so for arm64-v8a using Clang and Visual Studio 2017. (I made sure to preserve the case of the filename.)
I copy this file to the same directory that contains the .apk that gets launched. Is this the right directory for my .so? If not, should it be in another directory?
Do the error messages above mean that the .so file is not being found, or could it mean that the contents of the .so are invalid?
Is the .so file supposed to be inside the .apk somehow?
Is the DllImport directive wrong?
This Unity project and C++ DLL work as expected under Windows, with TestGame.dll in the same directory as the .exe.
IL2CPP is involved to allow calling C++ code from C#.
The .apk is also compiled for arm64-v8a, as shown by a log line that says “native-code: ‘arm64-v8a’”.
I appear to be using Unity 2019.3.1f1. The Target API Level is android-24.
Yes. Put the .so file into Unity project and set the correct settings in the Plugin Inspector, then it will be copied into apk and loaded (well, Unity will attempt to load it).
Since I’m working from a script, I copied the .so into Demos/Unity/Assets/Plugins/Android before Unity gets called to build the project. The .so ends up in lib/arm64-v8a/ inside the .apk.
Since it’s a C++ library, I had to link it with -lc++_static instead of -lc++_shared so that my .so would not depend on libc++_shared.so, which is apparently not present by default.