Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minitouch did not work,且尝试多种方法后均未解决 #22

Open
Pitiedwzr opened this issue Jul 1, 2023 · 11 comments
Open

minitouch did not work,且尝试多种方法后均未解决 #22

Pitiedwzr opened this issue Jul 1, 2023 · 11 comments

Comments

@Pitiedwzr
Copy link

IDE报:

发生异常: AssertionError
minitouch did not work. see https://github.com/williamfzc/pyminitouch/issues/11
  File "G:\TheTaleOfFood\SAS\SWYAutoScript\main.py", line 15, in <module>
    device = MNTDevice(_DEVICE_ID)
AssertionError: minitouch did not work. see https://github.com/williamfzc/pyminitouch/issues/11

按照#11 的解法,每次执行程序前都已重启ADB服务器:

os.system(f"adb kill-server")
os.system(f"adb start-server")
os.system(f"adb devices")
_DEVICE_ID = "emulator-5554"
device = MNTDevice(_DEVICE_ID)

每次点击完成后都会执行device.stop()

def click_position(x, y):
    device.tap([(x, y)])
    device.stop()

问题依旧未解决,第一次执行程序不会出现问题,之后会一直出现,重启模拟器后依旧仅第一次能够不出问题

没有安装uiautomator或者airtest

大佬看一下还有解吗,辛苦了

@williamfzc
Copy link
Owner

  • device.stop() 并不需要每次tap之后都调用
  • 我没有模拟器环境

@songyuc
Copy link

songyuc commented Nov 4, 2023

@williamfzc ,尊敬的开发者,你好,我们也是在模拟器上进行测试遇到了类似的问题:

Type A touch device androVM Virtual Input (1600x900 with 2 contacts) detected on /dev/input/event4 (score 11200)
binding socket: Address already in use
Unable to start server on minitouch
Traceback (most recent call last):
  File "D:\Program\**********\lab\test_pyminitouch.py", line 54, in <module>
    main()
  File "D:\Program\**********\lab\test_pyminitouch.py", line 42, in main
    device = MNTDevice("emulator-5554")
             ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\**********\mambaforge\envs\conda-general\Lib\site-packages\pyminitouch\actions.py", line 117, in __init__
    self.start()
  File "C:\Users\**********\mambaforge\envs\conda-general\Lib\site-packages\pyminitouch\actions.py", line 125, in start
    self.server = MNTServer(self.device_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\**********\mambaforge\envs\conda-general\Lib\site-packages\pyminitouch\connection.py", line 102, in __init__
    assert (
AssertionError: minitouch did not work. see https://github.com/williamfzc/pyminitouch/issues/11

Process finished with exit code 1

经过探索,我们发现:这是由于在测试脚本执行完毕后,/data/local/tmp/minitouch进程仍然驻留造成的;请问,对于这种情况,有什么比较好的解决办法吗?

期待您的回复!

@williamfzc
Copy link
Owner

@songyuc 可以在执行完毕时尝试利用adb把进程杀掉,如果进程没有正常结束的话

@songyuc
Copy link

songyuc commented Nov 8, 2023

@williamfzc ,您好,请问一下,您在实机测试中使用pyminitouch时,遇到过“minitouch”进程没有正常退出的情况吗?

@williamfzc
Copy link
Owner

@williamfzc ,您好,请问一下,您在实机测试中使用pyminitouch时,遇到过“minitouch”进程没有正常退出的情况吗?

没有。但我个人的样本量不大,不好做参考

@songyuc
Copy link

songyuc commented Nov 13, 2023

没有。但我个人的样本量不大,不好做参考

好的,感谢您的回复!

@songyuc
Copy link

songyuc commented Nov 13, 2023

@williamfzc,您好,我看到您在首页文档中引用的minitouch,仍然是旧版的openstf/minitouch
我们在讨论时想到,这个问题会不会是因为pyminitouch的预编译包使用旧版本,才会出现的呢

@williamfzc
Copy link
Owner

@williamfzc,您好,我看到您在首页文档中引用的minitouch,仍然是旧版的openstf/minitouch; 我们在讨论时想到,这个问题会不会是因为pyminitouch的预编译包使用旧版本,才会出现的呢

看了一下新版本只是换到了openstf namespace下,并没有对代码有什么改动的样子,可能影响不大。
当然也可能跟预编译包有关,亦可选择自行为你们的设备编译特定的版本。

我也留意到官方似乎并不打算原生支持 10+ 的版本,也可能与之后的安全策略有关系。
https://github.com/DeviceFarmer/minitouch#for-android-10-and-up

@songyuc
Copy link

songyuc commented Nov 15, 2023

@williamfzc,感谢您的解答!
还想请教一下,如果想在pyminitouch中配置为所需的设备编译特定的版本,这边有具体的实施步骤吗

@williamfzc
Copy link
Owner

@williamfzc,感谢您的解答! 还想请教一下,如果想在pyminitouch中配置为所需的设备编译特定的版本,这边有具体的实施步骤吗

https://github.com/williamfzc/pyminitouch/blob/master/pyminitouch/connection.py

提前把预编译好的minitouch推进设备,让他自动跳过下载的步骤即可

@songyuc
Copy link

songyuc commented Nov 15, 2023

@williamfzc 感谢您的回复,我们学习一下您的代码~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants