APP自动化测试之环境搭建:2. Android SDK安装配置
1.前提
基于win10专业版64位系统+jdk1.8+python3+pycharm+android SDK+appium+unittest。
为什么要装Android SDK,因为appium自动化测试脚本开发时需要用到Android SDK的三个工具:adb(查看设备udid等),aapt(查看app的主包名和主类名)和uiautomatorviewer(定位APP界面元素属性)。
2.Android SDK安装配置
下载Android SDK:
http://tools.android-studio.org/index.php/sdk
![afea565f-4b14-eb11-8da9-e4434bdf6706.png](http://p03.5ceimg.com/content/afea565f-4b14-eb11-8da9-e4434bdf6706.png)
解压到任意目录(注意,路径不能有空格和中文字符):
![b3ea565f-4b14-eb11-8da9-e4434bdf6706.png](http://p03.5ceimg.com/content/b3ea565f-4b14-eb11-8da9-e4434bdf6706.png)
配置环境变量:桌面“计算机”图标上右键选择“属性”,然后依次选择“高级系统设置-环境变量”打开如下界面:
![b8ea565f-4b14-eb11-8da9-e4434bdf6706.png](http://p04.5ceimg.com/content/b8ea565f-4b14-eb11-8da9-e4434bdf6706.png)
添加和编辑系统变量(注意一定要确保配置正确,且全部英文符号):
![bcea565f-4b14-eb11-8da9-e4434bdf6706.png](http://p05.5ceimg.com/content/bcea565f-4b14-eb11-8da9-e4434bdf6706.png)
![bfea565f-4b14-eb11-8da9-e4434bdf6706.png](http://p02.5ceimg.com/content/bfea565f-4b14-eb11-8da9-e4434bdf6706.png)
保留原有内容,在最前面加上如下内容:注意以下路径要与你的实际路径一致
%ANDROID_HOME%tools;%ANDROID_HOME%platform-tools;%ANDROID_HOME%build-tools29.0.0;
请务必将这两个目录放到path环境变量值的最前面,不然启动adb服务会有问题,连不上模拟器。
![c3ea565f-4b14-eb11-8da9-e4434bdf6706.png](http://p02.5ceimg.com/content/c3ea565f-4b14-eb11-8da9-e4434bdf6706.png)
![ccea565f-4b14-eb11-8da9-e4434bdf6706.png](http://p02.5ceimg.com/content/ccea565f-4b14-eb11-8da9-e4434bdf6706.png)
启动SDK管理器:
![d1ea565f-4b14-eb11-8da9-e4434bdf6706.png](http://p03.5ceimg.com/content/d1ea565f-4b14-eb11-8da9-e4434bdf6706.png)
按照如下几个截图勾选:
![d7ea565f-4b14-eb11-8da9-e4434bdf6706.png](http://p05.5ceimg.com/content/d7ea565f-4b14-eb11-8da9-e4434bdf6706.png)
![d9ea565f-4b14-eb11-8da9-e4434bdf6706.png](http://p01.5ceimg.com/content/d9ea565f-4b14-eb11-8da9-e4434bdf6706.png)
![ddea565f-4b14-eb11-8da9-e4434bdf6706.png](http://p01.5ceimg.com/content/ddea565f-4b14-eb11-8da9-e4434bdf6706.png)
![e2ea565f-4b14-eb11-8da9-e4434bdf6706.png](http://p02.5ceimg.com/content/e2ea565f-4b14-eb11-8da9-e4434bdf6706.png)
![e8ea565f-4b14-eb11-8da9-e4434bdf6706.png](http://p05.5ceimg.com/content/e8ea565f-4b14-eb11-8da9-e4434bdf6706.png)
![ebea565f-4b14-eb11-8da9-e4434bdf6706.png](http://p04.5ceimg.com/content/ebea565f-4b14-eb11-8da9-e4434bdf6706.png)
![eeea565f-4b14-eb11-8da9-e4434bdf6706.png](http://p03.5ceimg.com/content/eeea565f-4b14-eb11-8da9-e4434bdf6706.png)
![f1ea565f-4b14-eb11-8da9-e4434bdf6706.png](http://p03.5ceimg.com/content/f1ea565f-4b14-eb11-8da9-e4434bdf6706.png)
![f2ea565f-4b14-eb11-8da9-e4434bdf6706.png](http://p03.5ceimg.com/content/f2ea565f-4b14-eb11-8da9-e4434bdf6706.png)
经过以上配置,打开dos分别输入adb和aapt,能看到对应命令的使用帮助信息说明配置成功了。