I want to overwrite private data files on Android. To read and pull files, I already have an answer.
adb pull data/data/com.myapplication.package/files/myfile.extension
But now, I tried to push the file back after home-made changes:
adb push myfile.extension data/data/com.myapplication.package/files/myfile.extension
I get a "Permission denied
" error.
I tried to login on the shell and then change the permissions:
adb shell
chmod 777 data/data/com.myapplication.package/files/myfile.extension
I got a Operation not permitted
error.
Any idea on how to overwrite the existing file on the tablet ?
Try this:
adb shell
run-as com.myapplication.package
chmod 777 files
chmod 777 files/myfile.extension
The run-as
command allows you to execute shell commands with your app's rights. You can only use it on debuggable apps, which yours should be if you're developing it.