1、appium上勾选 No Reset
2、程序加上:capabilities.setCapability("noReset", true); //不需要再次安装
3、命令行模式启动appium 加命令 --no reset ,可惜我不能通过命令行启动appium,所以这个我也没试过;
ps:如果老是要安装下图那3个apk,例如小米3就会这样,还没去查原因,那就换一类手机试试看;
@BeforeMethod
public void setUp() throws Exception{
//set up appium设置apk路径
File classpathRoot=new File(System.getProperty("user.dir"));
File appDir=new File(classpathRoot, "apps");
File app=new File(appDir, "hlct_201604141758_2_0_1_release_signed.apk");
//设置自动化相关参数
DesiredCapabilities capabilities=new DesiredCapabilities();
// capabilities.setCapability("noReset", true); //不需要再次安装
capabilities.setCapability(CapabilityType.BROWSER_NAME, "");
capabilities.setCapability("platformName","Android");
capabilities.setCapability("deviceName","m1 metal");
//设置android系统版本
capabilities.setCapability("platformVersion","5.1.4");
//if no need install don't add this
//设置apk 的路径
capabilities.setCapability("app",app.getAbsolutePath());
//support Chinese支持中文输入
capabilities.setCapability("unicodeKeyboard","True");
//重置输入法为系统默认
capabilities.setCapability("resetKeyboard","True");
//no need sign 安装时不对apk进行重签名,设置很有必要,否则有的apk在重签名之后无法正常使用
capabilities.setCapability("noSign","True");
//设置app的主包名和主类名
capabilities.setCapability("appPackage","com.my089");
// capabilities.setCapability("appActivity","cn.jpush.android.ui.PushActivity");
capabilities.setCapability("appActivity","com.my089.activity.welcome.WelcomeActivity");//找开发要或是第一个activity
//初始化
driver = new AndroidDriver
}