I've been making an Android app that clears the Cache & Data of my application. Don't forget, my device is rooted. So why doesn't this piece of code work? It clearly has Root permissions and full paths. What's the problem behind this?
try {
Process p = Runtime.getRuntime().exec("su rm -r /data/user/0/com.rick.app");
p.waitFor();
p = Runtime.getRuntime().exec("su rm -r /data/user_de/0/com.rick.app");
p.waitFor();
p = Runtime.getRuntime().exec("su rm -r /storage/emulated/0/Android/data/com.rick.app");
p.waitFor();
p = Runtime.getRuntime().exec("su rm -r /data/data/com.rick.app");
p.waitFor();
p = Runtime.getRuntime().exec("su rm -r /data/app/com.rick.app");
p.waitFor();
p = Runtime.getRuntime().exec("su rm -r /storage/emulated/obb/com.rick.app");
p.waitFor();
p = Runtime.getRuntime().exec("su rm -r /storage/emulated/0/Android/data/com.rick.app/");
p.waitFor();
//p = Runtime.getRuntime().exec("reboot");
//p.waitFor();
//Runtime.getRuntime().exec("reboot");
} catch (IOException | InterruptedException e) {
e.printStackTrace();
}