google 例子:
https://github.com/android/testing-samples/tree/master/ui/uiautomator/BasicSample
如果编译下载不成功时,改build.gradle
google()
maven{ url 'http://maven.aliyun.com/nexus/content/repositories/central/'}
jcenter(){ url 'http://jcenter.bintray.com/'}
adb push mytest.jar /data/local/tmp/
adb shell uiautomator runtest mytest.jar -c ***.***.***.mytest (***.***.***为包名, mytest为类名)
adb shell am instrument -w -r -e package com.example.android.testing.uiautomator.BasicSample -e debug false com.example.android.testing.uiautomator.BasicSample.test/androidx.test.runner.AndroidJUnitRunner
下面是个打开关闭wifi很好的例子
https://blog.csdn.net/bbs11007/article/details/78337651
uiautomatorviewer location->Device screenshot
./sdk/tools/bin/uiautomatorviewer