Skip to content

[win32-x86-64] Unable to load library MaaFramework.dll #1

Description

@Circularorbit

After deploying the maven project, when I executed the QuickStart class, the result was an exception of java.lang.UnsatisfiedLinkError: Unable to load library MaaFramework.dll.

but the MaaFramework.dll file does exist in project-root/resources/maa/lib inside.

the OS is win64, the cpu is arm64, the jdk is openJDK 17.

at first, I thought the DLL was damaged, but even when I reinstalled the dependencies in the Maven local repository, this error still occurred.

image

When I was debugging, I found that he was using maa.win-x86_64

but i don't know how to do debug next, and check it out what problem.

image

Activity

  1. Circularorbit commented on Aug 24, 2024

    @Circularorbit
    Author

    I think this may be due to a lack of runtime dependencies with Microsoft, so I used the depands.exe tool to check its DLL and it turned out to be so.

    Download link depends official website
    Download link VC_redist.x64

    OK, the issue was done!!!

  2. Circularorbit commented on Sep 13, 2024

    @Circularorbit
    Author
  3. hanhuoer commented on Sep 21, 2024

    @hanhuoer
    Owner

    I think this may be due to a lack of runtime dependencies with Microsoft, so I used the depands.exe tool to check its DLL and it turned out to be so.

    Download link depends official website Download link VC_redist.x64

    OK, the issue was done!!!

    @Circularorbit 你好,请教一下,你这边是安装 Latest Microsoft Visual C++ Redistributable Version 之后就可以正常使用了吗?

    很奇怪,最近我在 MaaFramework 2.0 版本也遇到同样问题了,在你发之前没见到过,回来看了下才发现是一样的问题。

    用 dependencywalker 查了下,确实好多红的 dll,大概几百个吧,但 MaaFramework v1.8.9 也是同样,这就让人想不明白了。

    目前我这边测试的都是 win-x86_64,macos 倒是通过的,你最近有使用 v2.0 吗。

    环境

    Windows 10
    版本 10.0.19045
    系统类型 基于 x64 的电脑
    处理器 Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz,2601 Mhz,4 个内核,8 个逻辑处理器

    Java 11


    import com.sun.jna.Library;
    import com.sun.jna.Native;
    import io.github.hanhuoer.maa.util.FileUtils;
    
    public class MaaFrameworkTest {
        public interface MaaController1_8_9 extends Library {
            MaaController1_8_9 INSTANCE = Native.load("C:\\Users\\H\\Downloads\\MaaFW\\1.8.9\\MaaFramework.dll", MaaController1_8_9.class);
        }
    
        public interface MaaController2_0_0 extends Library {
            MaaController2_0_0 INSTANCE = Native.load("C:\\Users\\H\\Downloads\\MaaFW\\2.0.0-beta.4\\MaaFramework.dll", MaaController2_0_0.class);
        }
    
        public static void main(String[] args) {
            // System.out.println(MaaController1_8_9.INSTANCE);        
            System.out.println(MaaController2_0_0.INSTANCE);    
    		
        }
    }
    image
  4. moomiji commented on Sep 23, 2024

    @moomiji

    image

    https://github.com/lucasg/Dependencies

    MaaFrameworkX64.zip

    单独一个 MaaFramework.dll 应该只有 4 个红dll

  5. hanhuoer commented on Sep 23, 2024

    @hanhuoer
    Owner

    image

    https://github.com/lucasg/Dependencies

    MaaFrameworkX64.zip

    单独一个 MaaFramework.dll 应该只有 4 个红dll


    这是我用 Dependencies 打开 dll 后的情况,分别是 release 版本的 MaaFramework.dll 和你提供的 MaaFrameworkX64.dll

    MAA-win-x86_64-v2.0.0.zip

    展开查看 Release MaaFramework 2.0.0 依赖情况
    image
    

    MaaFrameworkX64.zip

    展开查看 MaaFrameworkX64.zip 依赖情况
    image
    
  6. hanhuoer commented on Sep 24, 2024

    @hanhuoer
    Owner

    [MAA-win-x86_64] 动态链接库(DLL)初始化例程失败

    问题找到了,是下面 dll 的版本问题,详情可以参考这个 issue。

    • msvcp140.dll
    • vcruntime.dll
  7. Circularorbit commented on Sep 28, 2024

    @Circularorbit
    Author

    I think this may be due to a lack of runtime dependencies with Microsoft, so I used the depands.exe tool to check its DLL and it turned out to be so.
    Download link depends official website Download link VC_redist.x64
    OK, the issue was done!!!

    @Circularorbit 你好,请教一下,你这边是安装 Latest Microsoft Visual C++ Redistributable Version 之后就可以正常使用了吗?

    很奇怪,最近我在 MaaFramework 2.0 版本也遇到同样问题了,在你发之前没见到过,回来看了下才发现是一样的问题。

    用 dependencywalker 查了下,确实好多红的 dll,大概几百个吧,但 MaaFramework v1.8.9 也是同样,这就让人想不明白了。

    目前我这边测试的都是 win-x86_64,macos 倒是通过的,你最近有使用 v2.0 吗。

    环境

    Windows 10 版本 10.0.19045 系统类型 基于 x64 的电脑 处理器 Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz,2601 Mhz,4 个内核,8 个逻辑处理器

    Java 11

    import com.sun.jna.Library;
    import com.sun.jna.Native;
    import io.github.hanhuoer.maa.util.FileUtils;
    
    public class MaaFrameworkTest {
        public interface MaaController1_8_9 extends Library {
            MaaController1_8_9 INSTANCE = Native.load("C:\\Users\\H\\Downloads\\MaaFW\\1.8.9\\MaaFramework.dll", MaaController1_8_9.class);
        }
    
        public interface MaaController2_0_0 extends Library {
            MaaController2_0_0 INSTANCE = Native.load("C:\\Users\\H\\Downloads\\MaaFW\\2.0.0-beta.4\\MaaFramework.dll", MaaController2_0_0.class);
        }
    
        public static void main(String[] args) {
            // System.out.println(MaaController1_8_9.INSTANCE);        
            System.out.println(MaaController2_0_0.INSTANCE);    
    		
        }
    }
    image

    MaaFramework v2.0.0问题找到了就好, 这类问题主要还是版本兼容, 运行环境的问题。
    我当时用的是MaaFramework v1.8.9, 主要原因的确是运行环境缺少了vc依赖。

  8. sandogeek commented on Dec 8, 2024

    @sandogeek

    建议readme加一下解决方案,因为直接按readme流程会报此问题

  9. sandogeek commented on Dec 8, 2024

    @sandogeek

    另外发现保证system32目录下的msvcp140版本正确的情况下,把java jdk bin目录下的msvcp140重命名为_msvcp140也可以解决问题

  10. hanhuoer commented on Dec 8, 2024

    @hanhuoer
    Owner

    建议readme加一下解决方案,因为直接按readme流程会报此问题

    好主意,晚点我更新一下

  11. pinned this issue on Dec 8, 2024
  12. sandogeek commented on Dec 8, 2024

    @sandogeek

    建议readme加一下解决方案,因为直接按readme流程会报此问题

    好主意,晚点我更新一下

    另外可以在加载MaaFramework前检查一下msvcp140.dll的版本,如果不满足要求就抛出一个带解决方案的异常

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions