通过adb打开android应用,我们需要做的第一步,就是查看当前app的入口,第二部,就是通过命令启动我们的app入口
查看app的启动画面
在运行下面命令时,先启动想要通过adb打开的app
#查看当前app的入口
adb shell dumpsys window windows | findstr "Current"
执行完了命令后,我们可以看到手机主界面的入口了。
adb打开App
#打开App方式 1
#com.tencent.mobileqq/com... 这个是上面获取到的
adb shell am start -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -n com.tencent.mobileqq/com.tencent.mobileqq.activity.SplashActivity
#打开方式2
adb shell am start -n com.tencent.mobileqq/com.tencent.mobileqq.activity.SplashActivity
命令之后显示“Starting: Intent { cmp=com.android.settings/.Settings}”,这表示设置App启动成功了。
参考文章
https://jingyan.baidu.com/article/1709ad807be8ac4634c4f032.html
http://blog.csdn.net/wang18323834864/article/details/78618748