Skip to content

Instantly share code, notes, and snippets.

@AwaisKing
Created June 5, 2020 14:58
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save AwaisKing/009a64d92d476da33036efd61c961a7a to your computer and use it in GitHub Desktop.
Save AwaisKing/009a64d92d476da33036efd61c961a7a to your computer and use it in GitHub Desktop.
fix - scrcpy adb push error / permissions denied

if you're getting this error:

ERROR: "adb push" returned with value 1

it's probably becuse of your phone's SELinux policy permissions, it happens when your phone's SELinux policy is either set to enforced or the folders'/files' SE Context permissions are set to system_data_files or shit like that

your phone must be rooted for this procedure

easy way (for kids)

all you gotta do is get Root Explorer (the paid one, idk if free one supports changing SE Context of stuff)

and change context of /data/local/ folder (WITH RECURSIVE BOX CHECKED) to u:object_r:shell_data_file:s0

or anything which has shell_data in the text


advanced way (not for me)

find out what what contexts are available in your device...

probably by reading context files in /system/etc/selinux (or) command : adb shell cat /system/etc/selinux/* | grep 'u:.*shell.*'

if there is something like shell_data_* just type in these commands

adb shell
su
chcon -R <the shell_data_* context you found> /data/local/

and that's it.

if none of that works for you, start praying to God.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment