我想使用C#从Android SP中通过PID终止进程 通常我是在命令行写的,如屏幕截图所示
adb shell
run-as "com.android.commands.monkey"
ps | grep "com.android.commands.monkey"
kill -9 73254
答案 0 :(得分:-1)
# Kill myphoneexplorer process on SP
adb shell "am force-stop com.fjsoft.myphoneexplorer.client"
sleep 2
# Kill com.android.commands.monkey process on SP
adb shell "run-as com.android.commands.monkey"
adb shell "ps | grep com.android.commands.monkey"
for item in $(adb shell "ps | grep com.android.commands.monkey"); do
if test "$item" != ""
then
arr+=($item)
echo ${arr[1]}
adb shell "kill -9 ${arr[1]}"
fi
done
sleep 2
sleep 10