有一个最简单的方法如下:
public void testScreen(){
UiDevice.getInstance().takeScreenshot(new File("/sdcards/test1.png"));
}
然后 main 方法调用此方法运行:
public static void main(String[] args) {
String jarName="Demoone";
String testClass="com.wch.Demo1";
String testName="testScreen";
String androidId="10";
new UiAutomatorHelper(jarName, testClass, testName, androidId);

}
然后控制台:

-----------start--uiautomator--debug-------------
----工作空间:
E:\android-workspace\Test
----execCmd: cmd /c android create uitest-project -n Demoone -t 10 -p "E:\android-workspace\Test"

Updated file E:\android-workspace\Test\build.xml

--------修改 build 完成---------
----execCmd: cmd /c ant
Buildfile: E:\android-workspace\Test\build.xml

-check-env:
[checkenv] Android SDK Tools Revision 25.2.5
[checkenv] Installed at D:\adt-bundle\sdk

-build-setup:
[getbuildtools] Using latest Build Tools: 23.0.3
[echo] Resolving Build Target for Demoone...
[getuitarget] Project Target: Android 4.4W.2
[getuitarget] API level: 20
[echo] ----------
[echo] Creating output directories if needed...

-pre-compile:

compile:
[javac] Compiling 1 source file to E:\android-workspace\Test\bin\classes
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:23: 警告: 编码 UTF-8 的不可映射字符
[javac] //getUiDevice().pressHome();//??????????????Щ???????????????????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:23: 警告: 编码 UTF-8 的不可映射字符
[javac] //getUiDevice().pressHome();//??????????????Щ???????????????????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:23: 警告: 编码 UTF-8 的不可映射字符
[javac] //getUiDevice().pressHome();//??????????????Щ???????????????????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:23: 警告: 编码 UTF-8 的不可映射字符
[javac] //getUiDevice().pressHome();//??????????????Щ???????????????????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:23: 警告: 编码 UTF-8 的不可映射字符
[javac] //getUiDevice().pressHome();//??????????????Щ???????????????????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:23: 警告: 编码 UTF-8 的不可映射字符
[javac] //getUiDevice().pressHome();//??????????????Щ???????????????????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:23: 警告: 编码 UTF-8 的不可映射字符
[javac] //getUiDevice().pressHome();//??????????????Щ???????????????????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:23: 警告: 编码 UTF-8 的不可映射字符
[javac] //getUiDevice().pressHome();//??????????????Щ???????????????????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:23: 警告: 编码 UTF-8 的不可映射字符
[javac] //getUiDevice().pressHome();//??????????????Щ???????????????????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:23: 警告: 编码 UTF-8 的不可映射字符
[javac] //getUiDevice().pressHome();//??????????????Щ???????????????????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:23: 警告: 编码 UTF-8 的不可映射字符
[javac] //getUiDevice().pressHome();//??????????????Щ???????????????????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:23: 警告: 编码 UTF-8 的不可映射字符
[javac] //getUiDevice().pressHome();//??????????????Щ???????????????????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:23: 警告: 编码 UTF-8 的不可映射字符
[javac] //getUiDevice().pressHome();//??????????????Щ???????????????????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:23: 警告: 编码 UTF-8 的不可映射字符
[javac] //getUiDevice().pressHome();//??????????????Щ???????????????????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:23: 警告: 编码 UTF-8 的不可映射字符
[javac] //getUiDevice().pressHome();//??????????????Щ???????????????????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:23: 警告: 编码 UTF-8 的不可映射字符
[javac] //getUiDevice().pressHome();//??????????????Щ???????????????????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:23: 警告: 编码 UTF-8 的不可映射字符
[javac] //getUiDevice().pressHome();//??????????????Щ???????????????????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:23: 警告: 编码 UTF-8 的不可映射字符
[javac] //getUiDevice().pressHome();//??????????????Щ???????????????????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:23: 警告: 编码 UTF-8 的不可映射字符
[javac] //getUiDevice().pressHome();//??????????????Щ???????????????????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:23: 警告: 编码 UTF-8 的不可映射字符
[javac] //getUiDevice().pressHome();//??????????????Щ???????????????????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:23: 警告: 编码 UTF-8 的不可映射字符
[javac] //getUiDevice().pressHome();//??????????????Щ???????????????????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:23: 警告: 编码 UTF-8 的不可映射字符
[javac] //getUiDevice().pressHome();//??????????????Щ???????????????????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:23: 警告: 编码 UTF-8 的不可映射字符
[javac] //getUiDevice().pressHome();//??????????????Щ???????????????????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:23: 警告: 编码 UTF-8 的不可映射字符
[javac] //getUiDevice().pressHome();//??????????????Щ???????????????????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:39: 警告: 编码 UTF-8 的不可映射字符
[javac] UiObject clock=new UiObject(new UiSelector().resourceId("com.android.gallery3d:id/appwidget_album_name"));//?????????????汾???????????????4.3?汾????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:39: 警告: 编码 UTF-8 的不可映射字符
[javac] UiObject clock=new UiObject(new UiSelector().resourceId("com.android.gallery3d:id/appwidget_album_name"));//?????????????汾???????????????4.3?汾????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:39: 警告: 编码 UTF-8 的不可映射字符
[javac] UiObject clock=new UiObject(new UiSelector().resourceId("com.android.gallery3d:id/appwidget_album_name"));//?????????????汾???????????????4.3?汾????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:39: 警告: 编码 UTF-8 的不可映射字符
[javac] UiObject clock=new UiObject(new UiSelector().resourceId("com.android.gallery3d:id/appwidget_album_name"));//?????????????汾???????????????4.3?汾????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:39: 警告: 编码 UTF-8 的不可映射字符
[javac] UiObject clock=new UiObject(new UiSelector().resourceId("com.android.gallery3d:id/appwidget_album_name"));//?????????????汾???????????????4.3?汾????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:39: 警告: 编码 UTF-8 的不可映射字符
[javac] UiObject clock=new UiObject(new UiSelector().resourceId("com.android.gallery3d:id/appwidget_album_name"));//?????????????汾???????????????4.3?汾????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:39: 警告: 编码 UTF-8 的不可映射字符
[javac] UiObject clock=new UiObject(new UiSelector().resourceId("com.android.gallery3d:id/appwidget_album_name"));//?????????????汾???????????????4.3?汾????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:39: 警告: 编码 UTF-8 的不可映射字符
[javac] UiObject clock=new UiObject(new UiSelector().resourceId("com.android.gallery3d:id/appwidget_album_name"));//?????????????汾???????????????4.3?汾????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:39: 警告: 编码 UTF-8 的不可映射字符
[javac] UiObject clock=new UiObject(new UiSelector().resourceId("com.android.gallery3d:id/appwidget_album_name"));//?????????????汾???????????????4.3?汾????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:39: 警告: 编码 UTF-8 的不可映射字符
[javac] UiObject clock=new UiObject(new UiSelector().resourceId("com.android.gallery3d:id/appwidget_album_name"));//?????????????汾???????????????4.3?汾????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:39: 警告: 编码 UTF-8 的不可映射字符
[javac] UiObject clock=new UiObject(new UiSelector().resourceId("com.android.gallery3d:id/appwidget_album_name"));//?????????????汾???????????????4.3?汾????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:39: 警告: 编码 UTF-8 的不可映射字符
[javac] UiObject clock=new UiObject(new UiSelector().resourceId("com.android.gallery3d:id/appwidget_album_name"));//?????????????汾???????????????4.3?汾????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:39: 警告: 编码 UTF-8 的不可映射字符
[javac] UiObject clock=new UiObject(new UiSelector().resourceId("com.android.gallery3d:id/appwidget_album_name"));//?????????????汾???????????????4.3?汾????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:39: 警告: 编码 UTF-8 的不可映射字符
[javac] UiObject clock=new UiObject(new UiSelector().resourceId("com.android.gallery3d:id/appwidget_album_name"));//?????????????汾???????????????4.3?汾????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:39: 警告: 编码 UTF-8 的不可映射字符
[javac] UiObject clock=new UiObject(new UiSelector().resourceId("com.android.gallery3d:id/appwidget_album_name"));//?????????????汾???????????????4.3?汾????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:39: 警告: 编码 UTF-8 的不可映射字符
[javac] UiObject clock=new UiObject(new UiSelector().resourceId("com.android.gallery3d:id/appwidget_album_name"));//?????????????汾???????????????4.3?汾????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:39: 警告: 编码 UTF-8 的不可映射字符
[javac] UiObject clock=new UiObject(new UiSelector().resourceId("com.android.gallery3d:id/appwidget_album_name"));//?????????????汾???????????????4.3?汾????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:39: 警告: 编码 UTF-8 的不可映射字符
[javac] UiObject clock=new UiObject(new UiSelector().resourceId("com.android.gallery3d:id/appwidget_album_name"));//?????????????汾???????????????4.3?汾????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:39: 警告: 编码 UTF-8 的不可映射字符
[javac] UiObject clock=new UiObject(new UiSelector().resourceId("com.android.gallery3d:id/appwidget_album_name"));//?????????????汾???????????????4.3?汾????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:39: 警告: 编码 UTF-8 的不可映射字符
[javac] UiObject clock=new UiObject(new UiSelector().resourceId("com.android.gallery3d:id/appwidget_album_name"));//?????????????汾???????????????4.3?汾????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:39: 警告: 编码 UTF-8 的不可映射字符
[javac] UiObject clock=new UiObject(new UiSelector().resourceId("com.android.gallery3d:id/appwidget_album_name"));//?????????????汾???????????????4.3?汾????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:39: 警告: 编码 UTF-8 的不可映射字符
[javac] UiObject clock=new UiObject(new UiSelector().resourceId("com.android.gallery3d:id/appwidget_album_name"));//?????????????汾???????????????4.3?汾????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:39: 警告: 编码 UTF-8 的不可映射字符
[javac] UiObject clock=new UiObject(new UiSelector().resourceId("com.android.gallery3d:id/appwidget_album_name"));//?????????????汾???????????????4.3?汾????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:39: 警告: 编码 UTF-8 的不可映射字符
[javac] UiObject clock=new UiObject(new UiSelector().resourceId("com.android.gallery3d:id/appwidget_album_name"));//?????????????汾???????????????4.3?汾????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:39: 警告: 编码 UTF-8 的不可映射字符
[javac] UiObject clock=new UiObject(new UiSelector().resourceId("com.android.gallery3d:id/appwidget_album_name"));//?????????????汾???????????????4.3?汾????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:39: 警告: 编码 UTF-8 的不可映射字符
[javac] UiObject clock=new UiObject(new UiSelector().resourceId("com.android.gallery3d:id/appwidget_album_name"));//?????????????汾???????????????4.3?汾????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:39: 警告: 编码 UTF-8 的不可映射字符
[javac] UiObject clock=new UiObject(new UiSelector().resourceId("com.android.gallery3d:id/appwidget_album_name"));//?????????????汾???????????????4.3?汾????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:39: 警告: 编码 UTF-8 的不可映射字符
[javac] UiObject clock=new UiObject(new UiSelector().resourceId("com.android.gallery3d:id/appwidget_album_name"));//?????????????汾???????????????4.3?汾????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:39: 警告: 编码 UTF-8 的不可映射字符
[javac] UiObject clock=new UiObject(new UiSelector().resourceId("com.android.gallery3d:id/appwidget_album_name"));//?????????????汾???????????????4.3?汾????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:56: 警告: 编码 UTF-8 的不可映射字符
[javac] * ????????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:56: 警告: 编码 UTF-8 的不可映射字符
[javac] * ????????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:56: 警告: 编码 UTF-8 的不可映射字符
[javac] * ????????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:56: 警告: 编码 UTF-8 的不可映射字符
[javac] * ????????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:56: 警告: 编码 UTF-8 的不可映射字符
[javac] * ????????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:56: 警告: 编码 UTF-8 的不可映射字符
[javac] * ????????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:61: 警告: 编码 UTF-8 的不可映射字符
[javac] // //??????е?
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:61: 警告: 编码 UTF-8 的不可映射字符
[javac] // //??????е?
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:61: 警告: 编码 UTF-8 的不可映射字符
[javac] // //??????е?
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:61: 警告: 编码 UTF-8 的不可映射字符
[javac] // //??????е?
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:61: 警告: 编码 UTF-8 的不可映射字符
[javac] // //??????е?
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:61: 警告: 编码 UTF-8 的不可映射字符
[javac] // //??????е?
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:64: 警告: 编码 UTF-8 的不可映射字符
[javac] // //???????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:64: 警告: 编码 UTF-8 的不可映射字符
[javac] // //???????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:64: 警告: 编码 UTF-8 的不可映射字符
[javac] // //???????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:64: 警告: 编码 UTF-8 的不可映射字符
[javac] // //???????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:64: 警告: 编码 UTF-8 的不可映射字符
[javac] // //???????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:64: 警告: 编码 UTF-8 的不可映射字符
[javac] // //???????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:67: 警告: 编码 UTF-8 的不可映射字符
[javac] // //?????С??????????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:67: 警告: 编码 UTF-8 的不可映射字符
[javac] // //?????С??????????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:67: 警告: 编码 UTF-8 的不可映射字符
[javac] // //?????С??????????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:67: 警告: 编码 UTF-8 的不可映射字符
[javac] // //?????С??????????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:67: 警告: 编码 UTF-8 的不可映射字符
[javac] // //?????С??????????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:67: 警告: 编码 UTF-8 的不可映射字符
[javac] // //?????С??????????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:67: 警告: 编码 UTF-8 的不可映射字符
[javac] // //?????С??????????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:67: 警告: 编码 UTF-8 的不可映射字符
[javac] // //?????С??????????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:67: 警告: 编码 UTF-8 的不可映射字符
[javac] // //?????С??????????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:67: 警告: 编码 UTF-8 的不可映射字符
[javac] // //?????С??????????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:75: 警告: 编码 UTF-8 的不可映射字符
[javac] // //????????????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:75: 警告: 编码 UTF-8 的不可映射字符
[javac] // //????????????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:75: 警告: 编码 UTF-8 的不可映射字符
[javac] // //????????????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:75: 警告: 编码 UTF-8 的不可映射字符
[javac] // //????????????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:75: 警告: 编码 UTF-8 的不可映射字符
[javac] // //????????????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:75: 警告: 编码 UTF-8 的不可映射字符
[javac] // //????????????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:75: 警告: 编码 UTF-8 的不可映射字符
[javac] // //????????????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:75: 警告: 编码 UTF-8 的不可映射字符
[javac] // //????????????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:75: 警告: 编码 UTF-8 的不可映射字符
[javac] // //????????????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:75: 警告: 编码 UTF-8 的不可映射字符
[javac] // //????????????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:84: 警告: 编码 UTF-8 的不可映射字符
[javac] //??????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:84: 警告: 编码 UTF-8 的不可映射字符
[javac] //??????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:84: 警告: 编码 UTF-8 的不可映射字符
[javac] //??????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:84: 警告: 编码 UTF-8 的不可映射字符
[javac] //??????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:84: 警告: 编码 UTF-8 的不可映射字符
[javac] //??????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:84: 警告: 编码 UTF-8 的不可映射字符
[javac] //??????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:99: 警告: 编码 UTF-8 的不可映射字符
[javac] * ?????? ????????????????????????????????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:99: 警告: 编码 UTF-8 的不可映射字符
[javac] * ?????? ????????????????????????????????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:99: 警告: 编码 UTF-8 的不可映射字符
[javac] * ?????? ????????????????????????????????
[javac] ^
[javac] E:\android-workspace\Test\src\com\wch\Demo1.java:5: 错误: 程序包 java.rmi.server 不存在
[javac] import java.rmi.server.UID;
[javac] ^
[javac] 1 个错误
[javac] 100 个警告

BUILD FAILED
D:\adt-bundle\sdk\tools\ant\uibuild.xml:183: Compile failed; see the compiler error output for details.

Total time: 1 second
----jar 包路径: "E:\android-workspace\Test\bin\Demoone.jar"
----adb push "E:\android-workspace\Test\bin\Demoone.jar" /data/local/tmp/
----execCmd: adb push "E:\android-workspace\Test\bin\Demoone.jar" /data/local/tmp/
[100%] /data/local/tmp/Demoone.jar
----runTest: adb shell uiautomator runtest Demoone.jar --nohup -c com.wch.Demo1#testScreen
----execCmd: adb shell uiautomator runtest Demoone.jar --nohup -c com.wch.Demo1#testScreen
INSTRUMENTATION_STATUS: numtests=1

INSTRUMENTATION_STATUS: stream=

com.wch.Demo1:

INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner

INSTRUMENTATION_STATUS: test=testScreen

INSTRUMENTATION_STATUS: class=com.wch.Demo1

INSTRUMENTATION_STATUS: current=1

INSTRUMENTATION_STATUS_CODE: 1

INSTRUMENTATION_STATUS: numtests=1

INSTRUMENTATION_STATUS: stream=

Failure in testScreen:

junit.framework.AssertionFailedError: Method "testScreen" not found

at com.android.uiautomator.testrunner.UiAutomatorTestRunner.start(UiAutomatorTestRunner.java:160)

at com.android.uiautomator.testrunner.UiAutomatorTestRunner.run(UiAutomatorTestRunner.java:96)

at com.android.commands.uiautomator.RunTestCommand.run(RunTestCommand.java:91)

at com.android.commands.uiautomator.Launcher.main(Launcher.java:83)

at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)

at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:251)

INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner

INSTRUMENTATION_STATUS: test=testScreen

INSTRUMENTATION_STATUS: class=com.wch.Demo1

INSTRUMENTATION_STATUS: stack=junit.framework.AssertionFailedError: Method "testScreen" not found

at com.android.uiautomator.testrunner.UiAutomatorTestRunner.start(UiAutomatorTestRunner.java:160)

at com.android.uiautomator.testrunner.UiAutomatorTestRunner.run(UiAutomatorTestRunner.java:96)

at com.android.commands.uiautomator.RunTestCommand.run(RunTestCommand.java:91)

at com.android.commands.uiautomator.Launcher.main(Launcher.java:83)

at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)

at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:251)

INSTRUMENTATION_STATUS: current=1

INSTRUMENTATION_STATUS_CODE: -2

INSTRUMENTATION_STATUS: stream=

Test results for WatcherResultPrinter=.F

Time: 0.044

FAILURES!!!

Tests run: 1, Failures: 1, Errors: 0

INSTRUMENTATION_STATUS_CODE: -1


---FINISH DEBUG----



↙↙↙阅读原文可查看相关链接,并与作者交流