Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by ninjafishnz · Jul 20, 2020 at 10:04 AM · androidandroid builddlldllnotfoundexceptiondllimport

Android 64-bit .so DLL file not found error

Hello,

I am trying to update an older plugin to work for Android 64 bit builds, and am running into problems. Namely, I am trying to update the "OpenCV + Unity" plugin, and I have already created a 64bit "libOpenCvSharpExtern.so" file by editing the repo here.

The file I have created is available here. I have checked using MSYS2 "file" commands that the file is a 64bit build file, which all seems to be correct, as far as I can tell. I have then added the file to "/Assets/../Plugins/Android/arm64-v8a/libOpenCvSharpExtern.so".

By my understanding, this should work. Instead, the .so file is not added to my APK and the DLL cannot be found, resulting in the error:

 <i>AndroidPlayer(ADB@127.0.0.1:34999)</i> DllNotFoundException: Unable to load DLL 'OpenCvSharpExtern': The specified module could not be found.
   at OpenCvSharp.NativeMethods.core_Mat_sizeof () [0x00000] in <00000000000000000000000000000000>:0 
   at OpenCvSharp.NativeMethods.TryPInvoke () [0x00000] in <00000000000000000000000000000000>:0 
   at OpenCvSharp.NativeMethods..cctor () [0x00000] in <00000000000000000000000000000000>:0 
   at OpenCvSharp.OCRHMMDecoder+ClassifierCallback..ctor (System.String fileName, OpenCvSharp.CvText+OCRClassifierType type) [0x00000] in <00000000000000000000000000000000>:0 
   at OpenCvSharp.Demo.AlphabetOCR..ctor (System.Byte[] model) [0x00000] in <00000000000000000000000000000000>:0 
   at molAR.Start () [0x00000] in <00000000000000000000000000000000>:0 
 Rethrow as OpenCvSharpException: Unable to load DLL 'OpenCvSharpExtern': The specified module could not be found.
 *** An exception has occurred because of P/Invoke. ***
 Please check the following:
 (1) OpenCV's DLL files exist in the same directory as the executable file.
 (2) Visual C++ Redistributable Package has been installed.
 (3) The target platform(x86/x64) of OpenCV's DLL files and OpenCvSharp is the same as your project's.
 
 System.DllNotFoundException: Unable to load DLL 'OpenCvSharpExtern': The specified module could not be found.
   at OpenCvSharp.NativeMethods.core_Mat_sizeof () [0x00000] in <00000000000000000000000000000000>:0 
   at OpenCvSharp.NativeMethods.TryPInvoke () [0x00000] in <00000000000000000000000000000000>:0 
   at OpenCvSharp.NativeMethods..cctor () [0x00000] in <00000000000000000000000000000000>:0 
   at OpenCvSharp.OCRHMMDecoder+ClassifierCallback..ctor (System.String fileName, OpenCvSharp.CvText+OCRClassifierType type) [0x00000] in <00000000000000000000000000000000>:0 
   at OpenCvSharp.Demo.AlphabetOCR..ctor (System.Byte[] model) [0x00000] in <00000000000000000000000000000000>:0 
   at myCode.Start () [0x00000] in <00000000000000000000000000000000>:0 
   at OpenCvSharp.NativeMethods.TryPInvoke () [0x00000] in <00000000000000000000000000000000>:0 
   at OpenCvSharp.NativeMethods..cctor () [0x00000] in <00000000000000000000000000000000>:0 
   at OpenCvSharp.OCRHMMDecoder+ClassifierCallback..ctor (System.String fileName, OpenCvSharp.CvText+OCRClassifierType type) [0x00000] in <00000000000000000000000000000000>:0 
   at OpenCvSharp.Demo.AlphabetOCR..ctor (System.Byte[] model) [0x00000] in <00000000000000000000000000000000>:0 
   at myCode.Start () [0x00000] in <00000000000000000000000000000000>:0 
 Rethrow as TypeInitializationException: The type initializer for 'OpenCvSharp.NativeMethods' threw an exception.
   at OpenCvSharp.OCRHMMDecoder+ClassifierCallback..ctor (System.String fileName, OpenCvSharp.CvText+OCRClassifierType type) [0x00000] in <00000000000000000000000000000000>:0 
   at OpenCvSharp.Demo.AlphabetOCR..ctor (System.Byte[] model) [0x00000] in <00000000000000000000000000000000>:0 
   at myCode.Start () [0x00000] in <00000000000000000000000000000000>:0 
  
 (Filename: currently not available on il2cpp Line: -1)


I have also tried to create a linker file based on another answer on this site, the file is called "link.dll" and has the below contents, which are quite possibly wrong:

     <linker>
            <assembly fullname="libOpenCvSharpExtern" preserve="all"/>
     </linker>

What am I doing wrong here? I am quite new to all this and likely doing something silly.

Thank you in advance for your help!

Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image JayPatoliyaBeetonz · Jan 29, 2021 at 06:55 AM 0
Share

have you ever find x64 libOpenCvSharpExtern.so with success build?

avatar image ninjafishnz JayPatoliyaBeetonz · Feb 07, 2021 at 10:44 PM 0
Share

I managed to get it by using the file linked in other replies on this thread, and following the correct selection process I mentioned below.

But my file is incomplete, I never managed to get DLib to work for it sadly.

1 Reply

· Add your reply
  • Sort: 
avatar image
4
Best Answer

Answer by ninjafishnz · Jul 23, 2020 at 10:53 PM

Turns out I made a very silly mistake. You need to actually go into the Unity editor, navigate to the file in your project, and instruct Unity what platform your .so file needs to target. In my case, I needed to select the "Android 64bit" option, and then the file worked.

Problem solved.

Comment
Add comment · Show 6 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image MichaelSolerBeatty · Jan 31, 2021 at 05:54 AM 1
Share

Could you please explain how to achieve to CREATE that ".so" file in UBUNTU or windows ?

It would be interesting to share it here with the community

Thanks for your time

avatar image ninjafishnz MichaelSolerBeatty · Feb 07, 2021 at 10:42 PM 1
Share

Given it's been over 6 months I'm afraid I don't remember how I did it. The vague steps were:

  1. Go to this GitHub repo and get the plugin's source code

  2. You'd need OpenCV contrib sources as well. The versions required by the plugin are listed in the plugin's repo and in the source code, so use those as reference. a. For the source - I'd go with official OpenCV GitHub repo, you can choose Branch -> Tags here and get specific version. b. Same for the OpenCV contrib c. The asset also uses DLib, I don't remember exact version, it should be is the build script code d. As for the Visual Studio version - it should work with any, but you'd need to change the target version in the build script. C$$anonymous$$ake supports up to the latest VS2019

There were a number of setup options for the ter$$anonymous$$al you needed as well. I did it on a Windows device, and these were the instructions I was given by the original developer:

You need $$anonymous$$SYS2, it will give you almost natural bash for Windows with pacman package installer. Once installed, run the following commands: pacman -S dash <- this will update one specific package pacman -Syu
<- this will update everything else, might be required to run it few times between $$anonymous$$SYS restarts (just follow console hints)

Now you have the proper bash. Your Windows drives will be available as "cd /c/{path here}" or "cd /d/{path here}" with everything else being normal unix-like shell. For here you will need: pacman -S $$anonymous$$gw-w64-x86_64-cmake <- here not the $$anonymous$$gw-w64-x86_64 part, it's ugly but necessary pacman -S $$anonymous$$gw-w64-x86_64-python3 <- not sure about this one, I guess OpenCV requires it for building pacman -S git <- optional

Every -S command will install all the necessary dependencies. Once it's done, you'll have shell with git, cmake, python and everything else required to compile. Cmake will "see" your Windows compiler, i.e. Visual Studio. Try those build scripts now, the results should make more sense.

Otherwise on macOS you'll need it's usual console (Applications/Utilities/Ter$$anonymous$$al), install Homebrew (because macOS lacks package manager) and have it prepare the same git/cmake/python for you.

Even with all of these, after adding the DLib files to the source files for the plugin I could not get DLib to co-operate. So, I can offer you the best I have.

Attached is the 64 bit Android .so file, it's all you need to make it run. However, because of the lack of DLib it doesn't have DNN capabilities and, as far as I am aware, is incapable of doing face tracking. It does do computer vision to some degree, which is what I was using, primarily the image processing work.

Here is the .so file on Google Drive.

Sorry I can't be more help, but hopefully those resources allow you to get somewhere!

avatar image FaiyazOfficial · Feb 05, 2021 at 12:20 PM 0
Share

Great. Can you let us know how to create .so file for a platform ?

avatar image ninjafishnz FaiyazOfficial · Feb 07, 2021 at 10:44 PM 1
Share

I've given an outline above, but I never managed to get the file to work exactly as intended and so it is missing some features.

The generation steps are above, but if you just wanted my file (without DNN and face tracking due to DLib not working), it is available at this link.

avatar image KVinS ninjafishnz · May 02, 2021 at 05:49 PM 1
Share

You still couldn't get the face tracking to work?

Show more comments

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

289 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to fix failed to load assets/Plugins/filename.dll with error the specified module could not be found and DllNotFoundException: Assets/Plugins/filename.dll 1 Answer

DLL NOT FOUND EXCEPTION even after following procedure 0 Answers

Referencing a DLL in C# 0 Answers

DLLs work on Windows but not on Android 1 Answer

UnityEngine.dll outside Unity 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges