Skip to content

Instantly share code, notes, and snippets.

@xgouchet
Created December 15, 2015 09:07
Show Gist options
  • Select an option

  • Save xgouchet/36720fad6125127db052 to your computer and use it in GitHub Desktop.

Select an option

Save xgouchet/36720fad6125127db052 to your computer and use it in GitHub Desktop.

Revisions

  1. xgouchet renamed this gist Dec 15, 2015. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. xgouchet created this gist Dec 15, 2015.
    18 changes: 18 additions & 0 deletions adb_kill
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    #########################################################################
    # Kill a running android process
    function adb_kill {
    if [[ -z $1 ]]; then
    echo "Usage : adb_kill com.example.application"
    else

    process=`adb shell ps | grep $1`

    if [[ -n $process ]]; then
    pid=`echo $process | awk '{print $2}'`
    echo "Killing process $pid"
    adb shell "run-as $1 kill $pid"
    else
    echo "App $1 not launchd"
    fi
    fi
    }