DllNotFoundException in unity3d plugin for c++ dll

后端 未结 7 1581
死守一世寂寞
死守一世寂寞 2021-01-11 17:49

I am working on the Unity Plugin project and try to import the c++ native dll from c# file. But I keep getting dllnotfoundexception.

c++ dll code:

7条回答
  •  爱一瞬间的悲伤
    2021-01-11 18:33

    I spent one day with this error. My issue was that Android doesn't get the library and always get and DDLNotFound error. My solution was:

    1.- Be sure that you have the libraries for the proper architecture in the Plugins folder.

    Plugins/Android/x86 and Plugins/Android/armeabi-v7a if your build settings is FAT(x86&arm)

    2.- Check that Unity recognizes them as libraries. If you select them in the Project tab you should see them as a library and the platform and architecture related.

    3.- After the build (don't close Unity Editor!), you can check in the Temp/StagingArea/libs if your libraries are there. If there are there for sure the libraries are going to be in the APK. As a double check, you can open your APK (change to zip extension) and see the libraries in the lib folder.

    4.- In C# you should remove any lib prefix in your library name, for example:

    If your library name is "libdosomething.so" you should call it as

    [DllImport ("dosomething")]

    I hope this work for you :)

    Cheers.

提交回复
热议问题