yangChong 2020-07-29
1 adb devices
1 adb -s 设备号 其他指令
1 adb install path\name.apk
1 adb install path\name.apk
1.查看apk主包名
知道apk包名,反编译操作
D:\>aapt dump badging jisuanqi_587.apk package: name=‘com.ibox.calculators‘ versionCode=‘587‘ versionName=‘2.8.7‘ platformBuildVersionName=‘6.0-2704002‘ sdkVersion:‘14‘ targetSdkVersion:‘19‘
不知道apk报名,打开模拟器中的app
1 D:\>adb shell dumpsys window | findstr mCurrentFocus 2 mCurrentFocus=Window{e66be70 u0 com.ibox.calculators/com.ibox.calculators.CalculatorActivity}
2.卸载操作
1 D:\>adb uninstall com.ibox.calculators 2 Success
1 D:\>adb shell 2 vbox86p:/ #
首先需要知道俩个,1.windos下文件的路径及文件名称,2.上传至手机模拟器上的路径
1 adb shell find / -name 文件夹名称 -type d
开始上传
1 D:\>adb push file_test.txt /data/media/0/Download 2 file_test.txt: 1 file pushed, 0 skipped. 0.0 MB/s (13 bytes in 0.002s)
注: file_test.txt 为当前D:\下的文档,/data/media/0/Download 为手机路径
1 D:\>adb pull /data/media/0/Download/test/file_test.txt File 2 /data/media/0/Download/test/file_test.txt: 1 file pulled, 0 skipped. 0.0 MB/s (13 bytes in 0.001s)
注: /data/media/0/Download/test/file_test.txt 为手机路径, File 为电脑路径
1 adb shell dumpsys package com.ibox.calculators
1 C:\Users\Alin>adb shell pm path com.ibox.calculators 2 package:/data/app/com.ibox.calculators-JFzmL_qeOWqldw_nuBAG2A==/base.apk
先根据adb shell dumpsys window | findstr mCurrentFocus查找到<package_name>/.<activity_class_name>,在使用adb shell am start -n <package_name>/.<activity_class_name>
C:\Users\Alin>adb shell am start -n com.ibox.calculators/com.ibox.calculators.CalculatorActivity Starting: Intent { cmp=com.ibox.calculators/.CalculatorActivity }
1 C:\Users\Alin>adb shell pm clear com.ibox.calculators 2 Success
C:\Users\Alin>adb shell ps|findstr com.ibox.calculators u0_a102 3988 282 984300 106688 ep_poll f15f4bb9 S com.ibox.calculators:ghosty u0_a102 4020 282 998936 107988 ep_poll f15f4bb9 S com.ibox.calculators:pushservice u0_a102 4030 1 985296 22240 unix_stream_read_generic f15f4bb9 S com.ibox.calculators:ghosty u0_a102 4059 282 1171828 215852 ep_poll f15f4bb9 S com.ibox.calculators
1 C:\Users\Alin>adb shell kill 5213
1 C:\Users\Alin>adb shell dumpsys meminfo com.ibox.calculators
1 adb shell input keyevent KEYCODE_BACK
相关命令可查看这个博客:https://www.cnblogs.com/bluestorm/p/4886662.html
adb logcat [选项] [过滤项] (选项过滤项可填可不填)
-s:设置输出日志的标签, 只显示该标签的日志;
C:\Users\Alin>adb logcat -s PackageManager --------- beginning of main --------- beginning of system 07-28 10:26:00.282 1091 1481 W PackageManager: Failure retrieving resources for com.ibox.calculators
-f:将日志输出到文件,该文件是在手机上的路径+文件名
1 C:\Users\Alin>adb logcat -f /data/media/0/Download/test.log
-c:清空所有日志的缓存信息
1 C:\Users\Alin>adb logcat -c
1 C:\Users\Alin>adb logcat *:W C:\Users\Alin>adb logcat -s System:E --------- beginning of main --------- beginning of system 07-28 10:37:40.043 6232 6410 E System : ******** DEPRECATED FUNCTIONALITY ******** 07-28 10:37:40.043 6232 6410 E System : * The implementation of the KeyFactory.RSA algorithm from 07-28 10:37:40.043 6232 6410 E System : * the BC provider is deprecated in this version of Android. 07-28 10:37:40.043 6232 6410 E System : * It will be removed in a future version of Android and your 07-28 10:37:40.043 6232 6410 E System : * application will no longer be able to request it. Please see 07-28 10:37:40.043 6232 6410 E System : * https://android-developers.googleblog.com/2018/03/cryptography-changes-in-android-p.html 07-28 10:37:40.043 6232 6410 E System : * for more details. 07-28 10:39:22.948 6232 6427 E System : ******** DEPRECATED FUNCTIONALITY ******** 07-28 10:39:22.948 6232 6427 E System : * The implementation of the KeyFactory.RSA algorithm from 07-28 10:39:22.948 6232 6427 E System : * the BC provider is deprecated in this version of Android. 07-28 10:39:22.948 6232 6427 E System : * It will be removed in a future version of Android and your 07-28 10:39:22.948 6232 6427 E System : * application will no longer be able to request it. Please see 07-28 10:39:22.948 6232 6427 E System : * https://android-developers.googleblog.com/2018/03/cryptography-changes-in-android-p.html 07-28 10:39:22.948 6232 6427 E System : * for more details.
adb shell cd system/app rm *.apk21. 获取管理员权限: adb root22. 启动Activity: adb shell am start -n 包名/包名+类名。
2、在设置好端口后就可输入命令连接:adb connect 192.168.2.36:5555,后面的:5555可以不用输入,例如我设置的:6666端口,则通过如下指令连接:。映像名称 PID 会话名