1.JAVA SDK
下载:https://www.oracle.com/java/technologies/javase-downloads.html
下载exe文件到本地,按照提示按照。
设置系统环境变量:
增加JAVA_HOME变量,值为D:\JAVA16(安装目录)
增加CLASSPATH变量,值为 .;%JAVA_HOME%\lib;%JAVA_HOME%\lib\tools.jar
path增加;%JAVA_HOME%\bin;%JAVA_HOME%\jre\bin
测试命令:java -version
2.ANDROID SDK
下载安装工具:https://www.androiddevtools.cn/
选择SDK的安装目录,安装EXE文件。
双击SDK Manager.exe运行管理工具。
默认自动选择最新的SDK版本,可以自己选择需要的工具和版本安装。
环境变量:
增加系统变量ANDROID_HOME,值为SDK根目录,如D:\ANDROID_SDK
在path增加;% ANDROID_HOME%\platform-tools;% ANDROID_HOME%\tools
测试命令:adb --version/adb devices
3.appium-desktop
下载:https://github.com/appium/appium-desktop/releases/tag/v1.19.1
按照提示安装即可。
启动参数Desired Capabilities:
{ "platformName": "Android", # 声明是ios还是Android系统 "platformVersion": "8.1.0", # Android内核版本号 "deviceName": "MI_5X", # 连接的设备名称 "appPackage": "com.tencent.qqmusic", # apk的包名 "appActivity": ".activity.AppStarterActivity", # apk的launcherActivity "resetKeyboard": True, "noReset": True # 在开始会话之前不要重置应用程序状态 }
{ "platformName": "Android", "platformVersion": "6.0.1", "deviceName": "OPPO_R9s", "appPackage": "com.ichi2.anki", "appActivity": ".IntentHandler", "resetKeyboard": true, "noReset": true }
{ "platformName": "Android", "platformVersion": "9", "deviceName": "MI_6X", "appPackage": "com.hrst.spark", "appActivity": ".ui.activity.SplashActivity", "resetKeyboard": true, "noReset": true }
获取手机和APP信息方法:
C:\Users\Administrator>adb devices
List of devices attached
dd3ac646 device
C:\Users\Administrator>adb shell getprop ro.build.version.release
6.0.1
C:\Users\Administrator>adb devices -l
List of devices attached
dd3ac646 device product:R9s model:OPPO_R9s device:R9s transport_id
:1
C:\Users\Administrator>adb shell dumpsys activity | findstr "mResume"
mResumedActivity: ActivityRecord{87c0d57 u0 com.tencent.mm/.ui.LauncherUI t3772}
C:\Users\Administrator>adb shell dumpsys activity | findstr "mResume"
mResumedActivity: ActivityRecord{565733d u0 com.alibaba.android.rimet/.biz.LaunchHomeActivity t3683}
C:\Users\Administrator>
OPPO R9s 附开发者模式打开方式:
设置-关于手机-版本号(点击7次)打开开发者功能
设置-其他设置-开发者选项,按需设置
必须打开“开发者选项”、“OEM解锁”、“USB调试”、“禁止权限监控”
查找APP启动package和activity:
执行命令:C:\Users\Administrator>adb logcat -s ActivityManager
监控logcat输出,然后点击APP,启动查看输出日志:
04-27 21:26:40.827 23292 24274 I ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.ichi2.a
nki/.IntentHandler bnds=[142,791][394,1067]} from uid 10055 and from pid 24339 on display
004-27 21:26:40.887 23292 23303 I ActivityManager: Start proc 25072:com.ichi2.anki/u0a191 for activity com.ichi2.anki/.IntentHandler
04-27 21:26:41.863 23292 24226 I ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10008000 cmp=com.ichi2.a
nki/.DeckPicker} from uid 10191 and from pid 25072 on display
004-27 21:26:41.864 23292 24226 W ActivityManager: Activity is launching as a new task, so cancelling activity result.
04-27 21:26:41.874 23292 24229 W ActivityManager: Duplicate finish request for ActivityRecord{27551ff u0 com.ichi2.anki/.IntentHandler t3866 f}