hanhuoer / maa-framework-java

MaaFramework Java SDK
GNU Lesser General Public License v3.0
8 stars 0 forks source link

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

Closed Circularorbit closed 1 month ago

Circularorbit commented 1 month ago

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

Circularorbit commented 1 month ago

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 commented 1 week ago

你好,Debug变量如下:

[cid:c5a4bd34-c5cb-4125-aa49-078780547229]

系统信息

[cid:bcba2291-afc0-498b-9de5-78794220af5a]

正常来说,64位ARM架构CPU的osArch才是arch64,

至于为什么英特尔64位x86架构CPU的osArch为什么是amd64,

我在网上查到,它们都是英特尔的别名,即:amd64=x86_64=x64


发件人: H @.> 发送时间: 2024年8月24日 21:11 收件人: hanhuoer/maa-framework-java @.> 抄送: Ulquiorra @.>; State change @.> 主题: Re: [hanhuoer/maa-framework-java] [win32-x86-64] Unable to load library MaaFramework.dll (Issue #1)

可以去 io.github.hanhuoer.maa.Maa 打个断点看看吗?

看下 osName osArch 这俩变量的值是什么。

因为我这边没有 arm64 的机器,所以之前写的时候可能忽略了这块,导致测试不充分。

讲道理你的环境应该会选择 win-aarch64 呀。

image.png (view on web)https://github.com/user-attachments/assets/8f90300d-26a3-4389-9ca2-94fee3575f9f

― Reply to this email directly, view it on GitHubhttps://github.com/hanhuoer/maa-framework-java/issues/1#issuecomment-2308391355, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A4MDUL4C4X3FWI7DGCFP2RDZTCA7ZAVCNFSM6AAAAABNBQFLI6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMBYGM4TCMZVGU. You are receiving this because you modified the open/close state.

hanhuoer commented 2 days ago

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
moomiji commented 9 hours ago

image

https://github.com/lucasg/Dependencies

MaaFrameworkX64.zip

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

hanhuoer commented 8 hours ago

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