1、查看设备名,win+R,运行输入框内输入cmd:输入adb devices ,查看设备名(需记下);
2、查看android应用包名、activity的方法:https://www.cnblogs.com/paulwinflo/p/4739734.html;
1):没有apk,应用已经安装到手机或虚拟机中:
logcat命令:输入 adb logcat -c 清除logcat内容;
启动logcat: 输入adb logcat ActivityManager:I*:s;
启动要查看的应用
2):dumpsys命令
启动要查看的程序;
命令行输入: adb shell dumpsys window w|findstr \/| findstr name=;
2、打开sdk->tools->uiautomatorviewer.bat,获取手机页面截屏。
3、编码:java;
4、启动appium,运行代码;
遇到的问题:
1、使用junit运行代码的时候,出现报错: Java.lang.NoClassDefFoundError: org/hamcrest/SelfDescribing;
原因:使用的junit jar包版本为4.12,从4.11版本开始,该jar包里面已经不包含hamcrest jar包了。
解决方法:1:降低junit jar包版本;2:下载hamcrest jar 包
2、实现类报错:
java.lang.IncompatibleClassChangeError: Implementing class;
解决方法:将原来的jar包全部移除后,再重新导入jar包/移除不需要的jar包。
3、The type java.lang.CharSequence cannot be resolved. It is indirectly referenced from required .class files。
原因&解决方法,在Stack Overflow上找到的: Java 8 supports default methods in interfaces. And in JDK 8 a lot of old interfaces now have new default methods. For example, now in CharSequence we have chars and codePoints methods.
If source level of your project is lower than 1.8, then compiler doesn't allow you to use default methods in interfaces. So it cannot compile classes that directly on indirectly depend on this interfaces.
If I get your problem right, then you have two solutions. First solution is to rollback to JDK 7, then you will use old CharSequence interface without default methods. Second solution is to set source level of your project to 1.8, then your compiler will not complain about default methods in interfaces。
4、java.lang.UnsupportedClassVersionError:Unsupported major.minor version51(由于上一个问题,我已经把jdk降到1.6了,但是,运行的时候报的这个错误,是因为jdk版本不支持。 The error regarding the unsupported major.minor version is because during compile time you are using a higher JDK and a lower JDK during runtime.)
把jdk升到1.7的时候有报错52了,没办法只能将jdk变回1.8,但是前面的第三的问题又出现了
解决方法:重新安装一个版本较高的eclipse;