写个远程操作Android的调试程序
调试Android真机,用手点击屏幕很是麻烦,用第三方的软件通常会安装不想要的app进去,还有可能占用adb端口与AS竞争。简单写一个显示屏幕和支持点击的程序,几分钟搞定。想更简单的可以直接下载exe程序运行。
https://download.csdn.net/download/jemenchen/90778624
目前不需要输入,只需要点击,就不错了,图标什么的也没换,临时用,不影响。
from time import sleepimport matplotlib.pyplot as plt
from PIL import Image
import os
path=os.getcwd()+'/example.jpg'def on_press(event):print("my position:" ,event.button,event.xdata, event.ydata)os.system('adb shell input tap '+str(int(event.xdata))+' '+str(int(event.ydata)))sleep(1)os.system('adb shell screencap -p /sdcard/screen.png')os.system('adb pull /sdcard/screen.png ' + path)img = Image.open(path)plt.imshow(img)plt.draw()os.system('adb shell screencap -p /sdcard/screen.png')
os.system('adb pull /sdcard/screen.png '+path)img=Image.open(path)fig=plt.figure()
plt.imshow(img)
plt.title('ADB Tool')
fig.canvas.mpl_connect('button_press_event', on_press)
fig.canvas.setWindowTitle('ADB Tool')
plt.show()