当前位置: 首页 > news >正文

专业柳州网站建设推荐工程报价

专业柳州网站建设推荐,工程报价,石台做网站,建筑工程网官网入口ADB 简介 adb的全称为Android Debug Bridge,安卓调试桥,可以通过调试命令来控制手机,诸如开机,关机等按键控制;或者启动,关闭应用;异或进行触摸模拟. 通过学习adb,可以实现简单的脚本控制,最大的特点是不需要root,对于普通手机都可以进行,帮助我们完成一些简单的重复性事件,…ADB 简介 adb的全称为Android Debug Bridge,安卓调试桥,可以通过调试命令来控制手机,诸如开机,关机等按键控制;或者启动,关闭应用;异或进行触摸模拟. 通过学习adb,可以实现简单的脚本控制,最大的特点是不需要root,对于普通手机都可以进行,帮助我们完成一些简单的重复性事件,诸如刷资源,各种app的签到 环境配置 电脑端 将下面3个文件弄到一个文件夹里D:\android\adb,然后将其添加到path,adb环境就配置好了 AdbWinUsbApi.dll AdbWinApi.dll adb.exe然后将这个文件夹添加到path中 cmd中 adb version检查是否添加成功 手机端 开发者选项 开启开发者选项 : 以小米手机为例,先进入开发者设置,miui版本号点5下,更多设置-开发者选项-开启 打开usb调试 : 在开发者选项中,开启usb调试以便于执行adb指令,miui还需要开启usb调试(安全设置) 获取坐标 : 开发者选项中,开启指针位置以便于模拟触摸时获取位置 设备管理 远程调试 基于内网穿透实现远程调试,就可以不用占用那少得可怜的usb口了,下面是统一管理所有设备的命令 开启关闭服务,默认会自动开启,关闭服务可用于断开多个连接的设备 adb start-server adb kill-serveradb devices 查看设备列表,如果有模拟器一般会自动连接,所以如果想在开模拟器时断开设备就需要获取模拟器ip:port然后断开实现步骤 先使用内网穿透得到虚拟IP 如100.119.133.92 推荐tailscale或蒲公英 手机通过usb调试设置监听端口adb tcpip 5555 断开手机后,电脑连接 如adb connect 100.119.133.92:5555 调试结束后可以adb disconnect 100.119.133.92:5555 断开连接 远程控制 scrcpy 使用这个软件,在上面远程连接之后就可以进行远程控制,当然也可以直接连usb获得稳定的投屏 手机adb Local ADB 先连接任意一个 Wi-Fi就算没有接入互联网都可以然后打开 LADB将它调整为小窗模式或分屏模式——因为无线调试的配对码等信息每次点击都会动态生成所以才需要小窗模式同时打开本应用和开发者选项进入开发者选项开启无线调试首次使用需要配对设备将配对码和端口填入本应用即可开心使用adb 应用管理 常见命令中常见pm和am的缩写 pm package manager am activity manager 一个package下有多个activity(界面) 查看应用列表 adb shell pm list packages 查看所有应用 adb shell pm list packages -s 查看系统应用 adb shell pm list packages -3 查看第三方应用 adb shell pm list packages vivo 查看带关键词vivo的应用安装应用 adb install [-r] [-d] [-g] apk-file -r覆盖 -d降级覆盖 -g授予所有运行权限例如 adb install D:\android\apk\com.supercell.clashofclans.apk 卸载应用 adb uninstall [-k] package-name -k 表示卸载应用但保留数据和缓存目录。例如adb uninstall com.supercell.clashofclans 获取activity和package 由adb shell dumpsys window w | findstr mCurrent 得到 mCurrentFocusWindow{8554b85 u0 com.supercell.clashofclans/com.supercell.titan.GameApp} 然后可以得到 activity : com.supercell.clashofclans/com.supercell.titan.GameApp package : com.supercell.clashofclans 可以通过下面cmd代码获取 echo offsetlocal enabledelayedexpansion rem 先查询window w mCurrent属性如果为空则查询window w imeControlTarget属性 for /f delims %%a in (adb shell dumpsys window w ^| findstr mCurrent) do set activity%%a if !activity! ( for /f delims %%a in (adb shell dumpsys window w ^| findstr imeControlTarget) do set activity%%a )rem 然后对获得的结果进行处理提取得到activity和package,先去除},然后取空格分隔的最后一部分,即activity,之后再得到package for /f delims} %%a in (!activity!) do set activity%%a rem for /f tokens3 delims %%a in (!activity!) do set activity%%a for %%I in (!activity!) do (set activity%%I) for /f tokens1 delims/ %%a in (!activity!) do set package%%aecho activity : !activity! echo package : !package!endlocal提取安装包 获取了安装路径后pull到指定目录里并重命名为com.supercell.clashofclans.apk adb shell pm path com.supercell.clashofclans adb pull /data/app/com.supercell.clashofclans-HyrIPsbKlOHBjZwM4LnczA/base.apk D:\android\com.supercell.clashofclans.apk用cmd实现批量操作 echo off rem 获取安装包 set outputpathD:\android\apk\ set packagecom.supercell.clashofclans for /f delims %%a in ( adb shell pm path %package% ) do set originalString%%a for /f tokens2 delims: %%a in (%originalString%) do set apkpath%%a adb pull %apkpath% %outputpath%%package%.apk启动和停止应用 rem 启动 adb shell am start -n com.supercell.clashofclans/com.supercell.titan.GameAppnul rem 强行停止 adb shell am force-stop com.supercell.clashofclans行为模拟 按键模拟 按键模拟都是像下面这种格式,不同的按键对应不同的id rem 模拟主页键 adb shell input keyevent 3下面是常用id-按键表 id按键3home4返回187多任务24增加音量25减小音量26电源键164静音220提高亮度221降低亮度 详细的见官网 KeyEvent | Android Developers 触摸模拟 rem 单击 (1200,70)为x,y坐标 adb shell input tap 1200 70rem 滑动 从(600,700)滑动到(600,900)经历1000ms adb shell input swipe 600 700 600 900 1000rem 长按 用滑动实现 adb shell input swipe 100 100 100 100 1000系统控制 rem 执行关机命令 adb shell reboot -prem 执行重启命令 adb shell rebootrem 进入Recovery adb reboot recoveryrem 进入Fastboot adb reboot fastboot实战 获取当前活动的activity和package echo offsetlocal enabledelayedexpansion rem 先查询window w mCurrent属性 for /f delims %%a in (adb shell dumpsys window w ^| findstr mCurrent) do set activity%%a if !activity! ( REM 如果没有查询到则查询window w imeControlTarget属性,此处只试了两款手机,其他的可以自己打印出window w再找 for /f delims %%a in (adb shell dumpsys window w ^| findstr imeControlTarget) do set activity%%a )rem 然后对获得的结果进行处理提取得到activity和package,先去除},然后取空格分隔的最后一部分,即activity,之后再得到package for /f delims} %%a in (!activity!) do set activity%%a rem 通过循环得到空格的最后一段,因为不同的指令输出的我们所需的信息都在最后 for %%I in (!activity!) do (set activity%%I) for /f tokens1 delims/ %%a in (!activity!) do set package%%aecho activity : !activity! echo package : !package!endlocalcoc辅助刷夜世界资源 坐标需要根据屏幕分辨率自行调整 chcp 65001 echo offset m7 :m set /a m1adb shell am start -n com.supercell.clashofclans/com.supercell.titan.GameApp nul choice /t 12 /d y nulset /a n %m% %% 8 if %n% 0 ( echo 圣水已收集 adb shell input swipe 600 700 600 900 1000 adb shell input tap 1060 80 adb shell input tap 1100 600 adb shell input tap 1200 70 )rem 皮卡一字滑 adb shell input tap 120 650 adb shell input tap 1035 500 choice /t 5 /d y nuladb shell input tap 360 650 FOR /L %%i in (1,1,2) DO ( adb shell input tap 200 100 adb shell input tap 200 450 adb shell input tap 1200 100 adb shell input tap 1200 450 )adb shell am force-stop com.supercell.clashofclans goto m冲杯 chcp 65001 echo offif %1 h goto begin mshta vbscript:createobject(wscript.shell).run(%~nx0 h,0)(window.close)exit :beginset m7 :m set /a m1adb shell am start -n com.supercell.clashofclans/com.supercell.titan.GameApp nul choice /t 12 /d y nulset /a n %m% %% 8 if %n% 0 ( echo 圣水已收集 adb shell input swipe 600 700 600 900 1000 adb shell input tap 1000 200 adb shell input tap 1100 600 adb shell input tap 1200 70 )adb shell input tap 120 650 adb shell input tap 1035 500 choice /t 5 /d y nuladb shell input tap 260 650 adb shell input tap 200 450 adb shell input tap 1200 100adb shell input tap 360 650 FOR /L %%i in (1,1,2) DO ( adb shell input tap 200 100 adb shell input tap 200 450 adb shell input tap 1200 100 adb shell input tap 1200 450 ) choice /t 80 /d y nul adb shell input tap 260 650 adb shell input tap 200 450 adb shell input tap 1200 100adb shell input tap 1100 660 FOR /L %%i in (1,1,3) DO ( adb shell input tap 200 100 adb shell input tap 200 450 adb shell input tap 1200 100 adb shell input tap 1200 450 )adb shell am force-stop com.supercell.clashofclansgoto mTODO 录制操作 record #!/bin/bash - if [ $1 -h ]; thenecho -s: to generate Shell file echo -c: to generate C program file echo -h: help exit fi #apk信息 PACKAGE$(awk -F $1~/PACKAGE/{print $2;exit} ./config.ini) ACTIVITY$(awk -F $1~/LAUNCH_ACTIVITY/{print $2;exit} ./config.ini) #设备信息 DEVICE_NAME$(awk -F $1~/DEVICE_NAME/{print $2;exit} ./config.ini) echo Touch device is [ $DEVICE_NAME ] #文件定义 file./out/cmds.txt t0filetmp0.txt t1filetmp1.txt t2filetmp2.txt#------------------------------------------------------------------------------- # 函数: 比较两个 Float 数值 #------------------------------------------------------------------------------- compare_float(){local a$1local b$2awk -va$a -vb$b BEGIN {if(ab) printf(true); else printf(false)} }compare_string(){local a$1local b$2awk -va$a -vb$b BEGIN {if(a!b) printf(true); else printf(false)} }#组合事件过滤条件echo -----recorder started trap echo recoder stopped SIGINT #重启app adb shell am force-stop $PACKAGE adb shell am start -W -n $PACKAGE/$ACTIVITY #获取输出事件并重定向到文件 adb shell getevent -t | grep -E --line-buffered $DEVICE_NAME $t0file echo -$DEVICE_NAME #替换[,],/dev/input/event/,:为空字符串 sed s/\[//g;s/\]//g;s/\/dev\/input\/event//g;s/\://g $t0file $t1file #把文件中的相关内容格式化 #正则解释: # 1. awk - 转换 第3列 和 第4列 数值为十进制模式(因为ioctl接收的是十进制) # 2. sed - 4294967295 实为 -1, 原因是-1为0xFFFF,FFFF(4294967295) cat $t1file |\awk {print $2, strtonum(0x$3), strtonum(0x$4), strtonum(0x$5)} |\sed s/4294967295/-1/g $t0file#sleep_arry_line() # 有睡眠操作的event #sleep_arry_time() # 保存睡眠时间 awk {print $1} $t1file $t2file # 抽取时间列存至 $t2file tstart$(sed -n 1p $t2file) tend$(sed -n $p $t2file) tdiff0 index1 while read t; docase $t in$tstart|$tend ) # 第一个时间和最后一个时间无需比较tdiff0.000000;;* )prev$(sed -n $(($index-1)) p $t2file)tdiff$(awk -va$t -vb$prev BEGIN {printf(%lf\n,a-b)});;esacecho $tdiff #sleep_arry_line($index)sleep_arry_time($(awk -va$tdiff BEGIN {print a*1000000}))((index)) done $t2file $t1file paste $t1file $t0file $filerm $t0file $t1file $t2file echo -----Generate txt file, output file is [ $file ]if ([[ $1 ~ s ]]); then# 两个event时间差# 因为一个触屏操作(如点击一下)需由多个event来组成mindiff0.01shellfile./out/cmds.shscmdfilescmd.txtssleepfilessleep.txtssleepfinalfilesleep.txtawk {print sendevent /dev/input/event$2 $3 $4 $5} $file $scmdfile awk {print $1} $file $ssleepfileindex1while read t;doif $(compare_float $mindiff $t); thenecho else echo sleep $t; fidone $ssleepfile $ssleepfinalfilepaste $ssleepfinalfile $scmdfile $shellfilerm $scmdfile $ssleepfinalfile $ssleepfileadb push ./out/cmds.sh /data/local/tmp/cmds.shecho -----Generate shell file , output file is [ $shellfile ] fi if ([[ $1 ~ c ]]); thenmodelcfiletemplate.c # 模板C语言文件targetcfile./jni/cmds.ctcfiletmpc.cmindiff$(awk -F $1~/TIME_INTERVAL/{print $2;exit} ./config.ini)currentdev$tcfilewhile read line; do # 输出临时C语言文件sleeptime$(echo $line|awk {print ($1)*1000000})device$(echo $line|awk {print /dev/input/event$2})type$(echo $line|awk {print $3})code$(echo $line|awk {print $4})value$(echo $line|awk {print $5})if $(compare_float $sleeptime $mindiff); thenecho usleep($sleeptime); $tcfilefiif $(compare_string $currentdev $device);then currentdev$devicecatEOF $tcfileevent.type $type;event.code $code;event.value ${value}u;fd open($device, O_RDWR);write(fd, event, event_size); EOFelsecatEOF $tcfileevent.type $type;event.code $code;event.value ${value}u;write(fd, event, event_size); EOFfidone $fileappend_line55sed $append_line r $tcfile $modelcfile $targetcfilerm $tcfileecho -----Generate C file , output file is [ $targetcfile ]#编译生成的c命令文件cd ./jnindk-buildcd ../cp ./libs/armeabi-v7a/cmds ./out/cmdsadb push ./out/cmds /data/local/tmp/cmdsrm -r ./libs ./obj fi #关闭app adb shell am force-stop $PACKAGE echo -----Successfully, totally spent time: $SECONDS secondsreplay #apk信息 PACKAGE$(awk -F $1~/PACKAGE/{print $2;exit} ./config.ini) ACTIVITY$(awk -F $1~/LAUNCH_ACTIVITY/{print $2;exit} ./config.ini) #重启app adb shell am force-stop $PACKAGE adb shell am start -W -n $PACKAGE/$ACTIVITY #回放事件 adb shell /data/local/tmp/cmds #不同的手机权限系统不一样如果你得手机需要root权限下才能运行回放命令请替换为以下回放命令 #adb shell su -c busybox chmod 755 /data/local/tmp/cmds #adb shell su -c /data/local/tmp/cmdsadb shell am force-stop $PACKAGEini *******************************以下配置信息中不能有空格**************************************** #apk信息 PACKAGEcom.baidu.searchbox LAUNCH_ACTIVITYcom.baidu.searchbox.MainActivity #输入device信息,多个输入设备用“|”分隔 DEVICE_NAMEevent2:|event9: #两个事件之间的间隔这个依据机器的性能而不同需要手动设置单位是微妙 TIME_INTERVAL10000
http://www.hkea.cn/news/14520121/

相关文章:

  • 内推网站建设旅游网站
  • 网站整站下载器下载utf8网页乱码网站建设拟采用的技术路线
  • 门户网站集约化建设宁波公司网站开发招聘
  • 建设统计网站进不去android开发培训
  • 山东省建设备案在哪个网站怎么自己写网站
  • 羽毛球网站建设网站秦皇岛陵县网站建设
  • 新浪做网站动漫制作专业要多少分
  • 网站建设的实施方案成都学校网站建设
  • 中企动力网站报价运营seo是什么意思
  • 做网站开发工具哪个好wordpress问答
  • 纪检监察网站建设方案指定网站建设项目规划书
  • 为什么一个网站外链那么多做网站软件的
  • 免费软件app下载大全正能量网站运动器材网站开发方案
  • 响应式旅游网站模板下载重庆唐卡装饰口碑怎么样
  • 贵阳网站建设推广公司企业所得税减免优惠政策
  • 免费的网站软件下载安装加盟培训网站建设
  • 广州天河区网站建设公司网页制作怎么上传到网站
  • 网站域名空间5个G的多少钱官方微信公众号怎么创建
  • 做网站费用做100个网站效果
  • 专业做网站厂家欧美设计网站
  • 网站的功能板块wordpress添加一个加载动画
  • 免费的企业网站建设手工制作小玩具简单又好玩
  • 化妆品网站建设推广方案国内十大高端定制西服品牌
  • 网站仿西安建站模板厂家
  • 设计国外网站成品网站管理系统 源码
  • 永州市开发建设投资有限公司网站石家庄互联网公司排行榜
  • wordpress 企业网站 教程杭州正规的网站建设公司
  • 网站备案提交资料揭阳做网站设计
  • 没网站怎么做京东联盟云落 wordpress主题
  • 开发一个网站需要几个人设计服务网站