MaaXYZ / MaaFramework

基于图像识别的自动化黑盒测试框架 | An automation black-box testing framework based on image recognition
GNU Lesser General Public License v3.0
1.31k stars 154 forks source link

python api 无法加载 ControlUnit 动态库 #108

Closed where2go947 closed 7 months ago

where2go947 commented 9 months ago

大佬您好,我在尝试看您sample/python下的代码,遇到了一些问题,如果您有空的话,可以解答一下吗:

  1. 自己尝试时,这里在建立连接报错:RuntimeError: Failed to create ADB controller(实际端口port是从bluestacks.conf中读取的,且检查过没问题) https://github.com/MaaAssistantArknights/MaaFramework/blob/5cd4cc945e395edfca47a7b4096b1885fcb807da/sample/python/__main__.py#L14
  2. debug发现,似乎是self._handle为空: https://github.com/MaaAssistantArknights/MaaFramework/blob/5cd4cc945e395edfca47a7b4096b1885fcb807da/source/binding/Python/maa/controller.py#L313-L324 3.而在library.py中,确实没有看到函数Library.framework.MaaAdbControllerCreateV2的定义。Library.framework是类型WinDLL : ...Library应该是正常加载了(Library.open(...)),请问是我哪里理解错了吗

目前是想先用python和Bluestacks 5建立连接,再去看流程怎么搭建,windows 10平台。然而卡在连接上了,希望大佬能看一下,谢谢!

MistEO commented 9 months ago

发下 debug 文件夹看看,里面有日志

MistEO commented 9 months ago

而在library.py中,确实没有看到函数Library.framework.MaaAdbControllerCreateV2的定义

这个 MaaAdbControllerCreateV2 是是动态库里的函数

where2go947 commented 9 months ago

发下 debug 文件夹看看,里面有日志

debug文件夹在哪里看呀(: 我是断点看的,报错内容是这个:

[2023-11-29 18:18:12.543][ERR][Px18556][Tx35055][PipelineResMgr.cpp][L58][MaaNS::ResourceNS::PipelineResMgr::load_all_json] path not exists
[2023-11-29 18:18:12.543][ERR][Px18556][Tx35055][PipelineResMgr.cpp][L23][MaaNS::ResourceNS::PipelineResMgr::load] load_all_json failed [path=my_resource/pipeline]
[2023-11-29 18:18:12.546][ERR][Px18556][Tx57548][LibraryHolder.h][L62][MaaNS::LibraryHolder<class MaaNS::AdbControlUnitLibraryHolder>::load_library] Failed to load library [libname=MaaAdbControlUnit] [message=????????????顣]
[2023-11-29 18:18:12.547][ERR][Px18556][Tx57548][ControlUnit.cpp][L34][MaaNS::AdbControlUnitLibraryHolder::create_control_unit] Failed to load library [libname_=MaaAdbControlUnit]
[2023-11-29 18:18:12.547][ERR][Px18556][Tx57548][MaaController.cpp][L33][MaaAdbControllerCreateV2] Failed to create control unit

是需要先编译cpp吗,能不能简单说一下步骤(非科班,对cmake不太熟)

MistEO commented 9 months ago

看起来是 1.3.0 版本引入了 bug,python api 不能正常运行了,你可以先试试 1.2.0 + python api,或者 1.3.0 + c api

where2go947 commented 9 months ago

好的,谢谢~

MistEO commented 9 months ago

Windows 修了,linux 下的不会弄,等个有缘的大佬

MistEO commented 7 months ago

https://blog.csdn.net/buknow/article/details/89407519 https://www.cnblogs.com/lidabo/p/17078906.html

找了点参考资料,mark,之后修下

MistEO commented 7 months ago

https://github.com/MaaAssistantArknights/MaaFramework/commit/d01da10a51110879a7bf7bb4e54ff9c487a1a774 fixed