I am trying to uninstall multiple packages using a bash script with adb uninstall.
In theory following scripts should work:
adb shell pm list packages com.your.app |
cut -d ':' -f 2 | while read line ; do
adb uninstall --verbose $line
done
OR
adb shell pm list packages com.your.app |
cut -d ':' -f 2 |
xargs -L1 -t adb uninstall
I get the following error
Failure [DELETE_FAILED_INTERNAL_ERROR]
I also found that the problem is with adb commands not taking piped arguments or arguments from shell variables. For example the following command also
echo com.your.app | adb uninstall
This will also give the same error.
I have already looked at delete packages of domain by adb shell pm
\r is added added to the output from the first command. We can use tr -d '\r'
to remove these characters.
adb shell pm list packages com.your.app |
cut -d ':' -f 2 |
tr -d '\r' |
xargs -L1 -t adb uninstall
Found the solution in Echo outputting results in erratic order in BASH