gpt4 book ai didi

android adb 的 python 绑定(bind)

转载 作者:太空宇宙 更新时间:2023-11-04 03:50:21 25 4
gpt4 key购买 nike

我正在用 python 为我们的 android 设备创建一个自动化框架。我通过使用 Popen 运行 adb 为 adb 命令编写了一个包装器。这很好,但我宁愿跳过为每个调用创建的过程(对 adb 的多次调用)所以我考虑为 C 代码创建绑定(bind)(adb 在 C 中)。

据我所知,有 3 个选项:1. 将 adb 编译为 SO 并使用 ctypes。2. 使用 python.h 创建 python 扩展,并将 adb 源代码添加到编译中,为命令创建一个完整的 python 接口(interface)。3. 使用 Cython 执行与 #2 相同的操作。

由于我以前从未这样做过,对于哪种方法更适合我的情况,有什么建议吗?考虑性能和上市时间。

最佳答案

不需要 c 绑定(bind)。只需使用套接字从您的 python 代码连接到 adb 守护程序 https://gist.github.com/ktnr74/6755712

关于android adb 的 python 绑定(bind),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21110098/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com