Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Bug Android Native Plugin - DllNotFoundException

Discussion in 'Editor & General Support' started by mmar58, May 16, 2024.

  1. mmar58

    mmar58

    Joined:
    Nov 2, 2022
    Posts:
    4
    I was trying to build c++ native plugin for unity android and facing dll not found issue and then I tried the sample native plugin package unity providing in this link https://docs.unity3d.com/Manual/android-native-plugins-call.html and I found the error when running
    Exception: DllNotFoundException: Unable to load DLL 'native'. Tried the load the following dynamic libraries: Unable to load dynamic library 'native' because of 'Failed to open the requested dynamic library (0x06000000) dlerror() = dlopen failed: library "native" not found
    CallNativeCode.add (System.Single x, System.Single y) (at <00000000000000000000000000000000>:0)
    CallNativeCode.Start () (at <00000000000000000000000000000000>:0)

    The packages I built also was giving same errors.
    How to solve this problem?
     
  2. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,767
    Could you show the code for your C# script, C++ code and how you've setup the plugins?
     
  3. mmar58

    mmar58

    Joined:
    Nov 2, 2022
    Posts:
    4
  4. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,767
    Yikes, that sample project is very out of date. It only contains armv7 native library, so to run it on armv8 you need to recompile the library yourself for that architecture.
     
    mmar58 likes this.
  5. mmar58

    mmar58

    Joined:
    Nov 2, 2022
    Posts:
    4
    Thanks. Yes it's working in armv7
     
  6. manugil

    manugil

    Unity Technologies

    Joined:
    Jan 13, 2020
    Posts:
    86
    Hey @mmar58, thank you for reporting this issue.

    The docs have now been updated, AndroidNativePlugin.unitypackage now includes native libraries for all the architectures Unity supports (
    armv7
    ,
    arm64
    ,
    x86
    and
    x86_64
    ).