问题
I have my application's package (com.my.package) and i'd like to be able to copy some files (a.txt, b.txt and c.txt) to another package (data/data/com.another.package/files). Now i've tried a few things i found, but none worked. Any help please?
回答1:
You need to get the Runtime and use the cat
command.
Runtime.getRuntime().exec("su cat filepath1 > filepath2");
回答2:
Runtime.getRuntime().exec("su cat filepath1 > filepath2");
creates an empty file for me too. I have to use su -c
instead
Runtime.getRuntime().exec("su -c cat filepath1 > filepath2");
来源:https://stackoverflow.com/questions/15886744/copy-files-to-another-package-folder-root-su