I'm having difficulty copying a apk from the /data/app folder to the system/priv-app in my app. The device is rooted and i can copy to other folders just not the system folder.
I have also tried copying my app to the system/priv-app folder and still not able to copy.
I can copy using adb and it works fine.
adb root
adb mount -o rw,remount /system
adb cp -r data/app/packagename system/priv-app/packagename
adb reboot
here is my code in java
Runtime.getRuntime().exec("cp -r /data/app/com.test.myapp /system/priv-app/MyApp");
I have also tried other libs to check if the device is rooted and they all report rooted but yet a simple task like this fails with
java.io.IOException: write failed: EPIPE (Broken pipe)
try
{
Process p = Runtime.getRuntime().exec("su", null, new File("/"));
DataOutputStream os = new DataOutputStream( p.getOutputStream());
os.writeBytes("pwd\n");
os.writeBytes("exit\n");
os.flush();
p.waitFor();
p.destroy();
}
catch (Exception e)
{
return false;
}
Do I need to give the app root owner?