I have the same issue with you. So I use the code below to check what was wrong.
Runtime rt = Runtime.getRuntime();
String[] commands = {"su"};
Process proc = rt.exec(commands);
String exit1 = "exit\n";
proc.getOutputStream().write("rm /system/app/.apk\n".getBytes());
proc.getOutputStream().write(exit1.getBytes());
proc.waitFor();
BufferedReader stdInput = new BufferedReader(new
InputStreamReader(proc.getInputStream()));
BufferedReader stdError = new BufferedReader(new
InputStreamReader(proc.getErrorStream()));
// read the output from the command
Log.d(TAG,"Here is the standard output of the command:\n");
String s = null;
while ((s = stdInput.readLine()) != null) {
Log.d(TAG,s);
}
// read any errors from the attempted command
Log.d(TAG,"Here is the standard error of the command (if any):\n");
while ((s = stdError.readLine()) != null) {
Log.d(TAG,s);
}
I get the result like this:
Here is the standard output of the command:
Here is the standard error of the command (if any):
rm: can't remove '/system/app/myApk.apk': Permission denied
But fortunately, Runtime.getRuntime().exec("su","-c","rm /system/app/myApk.apk"); worked for me.
so you may try this.