Android patch permission denied

Hi!

I am not able to patch updates of my android game directly to the phone over USB anymore.
While trying to deploy, I get the following log:

[pram:06.667][v ] Executing: “A:/Unity/Hub/2022.3.50f1/Editor/Data/PlaybackEngines/AndroidPlayer/SDK/platform-tools/adb.exe” -s RZCTBFGSK6P push --sync “A:/Unity/Projects/Pixeldrop/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/src/main/assets/bin/Data/.” “/storage/emulated/0/Android/data/com.TortillaCake.Pixeldrop/pram-shadow-files/assets/bin/Data”
[pram:06.957][inf] Failed pushing files to devices RZCTBFGSK6P , potentially due to connection issues. Retrying (1/3)
[pram:06.957][v ] Executing: “A:/Unity/Hub/2022.3.50f1/Editor/Data/PlaybackEngines/AndroidPlayer/SDK/platform-tools/adb.exe” -s RZCTBFGSK6P push --sync “A:/Unity/Projects/Pixeldrop/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/src/main/assets/bin/Data/.” “/storage/emulated/0/Android/data/com.TortillaCake.Pixeldrop/pram-shadow-files/assets/bin/Data”
[pram:07.235][inf] Failed pushing files to devices RZCTBFGSK6P , potentially due to connection issues. Retrying (2/3)
[pram:07.235][v ] Executing: “A:/Unity/Hub/2022.3.50f1/Editor/Data/PlaybackEngines/AndroidPlayer/SDK/platform-tools/adb.exe” -s RZCTBFGSK6P push --sync “A:/Unity/Projects/Pixeldrop/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/src/main/assets/bin/Data/.” “/storage/emulated/0/Android/data/com.TortillaCake.Pixeldrop/pram-shadow-files/assets/bin/Data”
[pram:09.917][inf] Failed pushing files to devices RZCTBFGSK6P , potentially due to connection issues. Retrying (3/3)
[pram:09.917][v ] Executing: “A:/Unity/Hub/2022.3.50f1/Editor/Data/PlaybackEngines/AndroidPlayer/SDK/platform-tools/adb.exe” -s RZCTBFGSK6P push --sync “A:/Unity/Projects/Pixeldrop/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/src/main/assets/bin/Data/.” “/storage/emulated/0/Android/data/com.TortillaCake.Pixeldrop/pram-shadow-files/assets/bin/Data”
[pram:10.046][v ] Push to “/storage/emulated/0/Android/data/com.TortillaCake.Pixeldrop/pram-shadow-files” failed. Workaround by pushing to “/data/local/tmp/pram-shadow-files-tmp/com.TortillaCake.Pixeldrop” was not found to be applicable.
[pram:10.047][err] ‘“A:/Unity/Hub/2022.3.50f1/Editor/Data/PlaybackEngines/AndroidPlayer/SDK/platform-tools/adb.exe” -s RZCTBFGSK6P push --sync “A:/Unity/Projects/Pixeldrop/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/src/main/assets/bin/Data/.” “/storage/emulated/0/Android/data/com.TortillaCake.Pixeldrop/pram-shadow-files/assets/bin/Data”’ returned with exit code 1.
[pram:10.047][err] Err:
[pram:10.047][err]
[pram:10.047][err] Out:
[pram:10.047][err] adb: error: failed to copy ‘A:/Unity/Projects/Pixeldrop/Library/Bee/Android/Prj/IL2CPP/Gradle/unityLibrary/src/main/assets/bin/Data/.\Managed\Metadata\global-metadata.dat’ to ‘/storage/emulated/0/Android/data/com.TortillaCake.Pixeldrop/pram-shadow-files/assets/bin/Data/./Managed/Metadata/global-metadata.dat’: remote secure_mkdirs() failed: Operation not permitted
[pram:10.047][err] [ 0%] /storage/emulated/0/Android/data/com.TortillaCake.Pixeldrop/pram-shadow-files/assets/bin/Data/./Managed/Metadata/global-metadata.dat: 0%
[pram:10.047][err]
[pram:10.047][err]

It seems like a permission issue so I tried to run the adb push command manually in the shell, which also returns a “permission denied” except if I am running the shell as admin (which won’t work for Unity…).
I don’t know if it’s related to a software update on my phone or an Unity editor version since patching used to work fine a few months ago and I also couldn’t find anything useful on google about this issue.

Thank’s for any help :slight_smile:

What device/OS version do you use?
Some devices to have security restrictions and patching does not work, most notably later Samsung models.
Technically it is possible (we do this for OBB files), but complicated and slow: files has to be pushed to devices, made readable to app and then copied using apps user to correct location (so that file permissions are correct, runas command IIRC). Other ways won’t work, even if files end up in correct location, app will not be able to read them due to incorrect permissions. As I remember, it not unix permissions, but also SELinux label.

Thanks for your reply.
It’s a Samsung A53 with Android 14. I used the same device a few months ago and patching worked fine. So maybe it was caused by an Android Update I did in between… but wouldn’t that affect all other Android devices with that Version too and patching would become useless/defect?

When significantly large portion of devices is affected, it will increase the priority of this issue. Right now it’s quite low.