Stopping an Android app from console

前端 未结 11 701
情书的邮戳
情书的邮戳 2020-11-27 09:30

Is it possible to stop an Android app from the console? Something like:

adb stop com.my.app.package

It would speed up our testing process s

11条回答
  •  执笔经年
    2020-11-27 09:55

    If you have access to the application package, then you can install with the -r option and it will kill the process if it is currently running as a side effect. Like this:

    adb -d install -r MyApp.apk ; adb -d shell am start -a android.intent.action.MAIN -n com.MyCompany.MyApp/.MyActivity

    The -r option preserves the data currently associated with the app. However, if you want a clean slate like you mention you might not want to use that option.

提交回复
热议问题