2

I try to move account-related files/directories of an app (for account changing purposes) via adb shell mv. Moving the files works great, but the app hangs while loading/login.

If I move the files manually via files manager, there is no problem at all (I move the files from /data/data/com.example.app to sdcard and move the same files from another account back to the app folder) -> everything works fine, the app is loading, the account is logged in and changing accounts works without any problem.

If I move the files via adb shell mv, the app is stuck while loading. If I move the files to sdcard via adb shell mv and move it back with the file manager, it also works fine. But if I move the files from sdcard to app folder, it doesn't work.

I also tried copying the file via adb shell cp -r but got the same problem.

Does anybody have an idea what's the problem or how to fix this problem? Does mv corrupt the files? But if it would corrupt the files, it wouldn't work if I moved it to sdcard via shell mv and moved it back via files manager.


It seems like Robert is right, the file group changes:

Folder original:

drwxrws--x 8 u0_a295 u0_a295_cache 3452 2024-01-31 10:30
drwxrwx--x 3 u0_a295 u0_a295       3452 2024-01-31 10:31

Folder after moving:

drwxrws--- 10 u0_a218 media_rw 3452 2024-01-31 10:33
drwxrws---  4 u0_a218 media_rw 3452 2024-01-31 10:33

Files original:

-rw-rw---- 1 u0_a295 u0_a295    1229 2024-01-31 10:32

Files after moving:

-rw-rw---- 1 u0_a218 media_rw    1229 2024-01-31
0

1 Answer 1

3

Your main problem is that you move files and folder between special sections of the file-system: from app-private folder where only the app has access to /sdcard a special folder where you can not execute something and all files/folders are assigned a special group media_rw.

For understanding why the app-private folder works you need to know that Android created for every app an own user account, in your example all app-private files and folders are owned by user u0_a295 and group u0_a295 / u0_a295_cache.

If you move the files to /sdcard the group is changed to media_rw as the sd-card section enforces this. If you later move back the files to the app-private folder the group media_rw remains and the files and folders have a changed owner-user and owner-group.

To correct that you can execute

chown -R u0_a295:u0_a295 /data/data/<app-package name>/files/

Note that if you uninstall and reinstall the app or try the same with a different app the user and group name will be different (not u0_a295).

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .