Skip to content

Instantly share code, notes, and snippets.

@mlykotom
Last active July 5, 2021 18:26
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save mlykotom/18d48ec6cc75f935ed7658867cedad5f to your computer and use it in GitHub Desktop.
Save mlykotom/18d48ec6cc75f935ed7658867cedad5f to your computer and use it in GitHub Desktop.
Script for killing Android app (as system would)
#!/bin/bash
# Provide package of your application (com.example.myapp)
PACKAGE=$1
# First, put your app to background and then run this script
echo "Killing $PACKAGE"
adb shell ps | grep $PACKAGE | awk '{print $2}' | xargs adb shell run-as $PACKAGE kill
@mlykotom
Copy link
Author

mlykotom commented Nov 25, 2019

  1. put your app to background
  2. run this script with proper app package
  3. reopen the app

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment