uiautomator2啟動apk猛们,在android api 21+以上可以使用executeShellCommand.
當android api低于21時,可以使用intent的方式啟動apk.實例如下:
Intent intent=new Intent(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
ComponentName cn = new ComponentName(packageName, className);
intent.setComponent(cn);
startActivity(intent);