通用技术 /system/bin/sh: screenrecord: inaccessible or not found 报错解决方案

xiaoxiao · 2020年11月06日 · 27120 次阅读

在我们平时测试工作中,可能需要对 Android 手机进行录屏,第一时间我们肯定想到强大的 adb 命令。但是当我们用 adb 录制的时候,往往会报错 screenrecord: inaccessible or not found

~ $ adb shell screenrecord /sdcard/test.mp4
/system/bin/sh: screenrecord: inaccessible or not found

这是因为现在很多手机为了安全把 screenrecord 功能给回收了,导致我们无法再用该命令行进行录屏操作。
通过adb shell ls /system/bin/命令可以看到ls: /system/bin//screenrecord: Permission denied,说明确实没有录屏权限了。

~ $ adb shell ls /system/bin/
ls: /system/bin//adbd: Permission denied
ls: /system/bin//apexd: Permission denied
ls: /system/bin//art_apex_boot_integrity: Permission denied
ls: /system/bin//ashmemd: Permission denied
ls: /system/bin//asserttip: Permission denied
ls: /system/bin//atlasservice: Permission denied
ls: /system/bin//audioserver: Permission denied
ls: /system/bin//auditctl: Permission denied
ls: /system/bin//autochmod.sh: Permission denied
ls: /system/bin//blank_screen: Permission denied
ls: /system/bin//blkid: Permission denied
ls: /system/bin//bootanimation: Permission denied
ls: /system/bin//bootstat: Permission denied
ls: /system/bin//bpfloader: Permission denied
ls: /system/bin//br_app_data_service: Permission denied
ls: /system/bin//bspCriticalLog: Permission denied
ls: /system/bin//bspFwUpdate: Permission denied
ls: /system/bin//bt_logger: Permission denied
ls: /system/bin//cachebench_eng: Permission denied
ls: /system/bin//cameraserver: Permission denied
ls: /system/bin//charger: Permission denied
ls: /system/bin//chcon: Permission denied
ls: /system/bin//clatd: Permission denied
ls: /system/bin//common_dcs: Permission denied
ls: /system/bin//cpustress_eng: Permission denied
ls: /system/bin//criticallog: Permission denied
ls: /system/bin//datafree: Permission denied
ls: /system/bin//dex2oat: Permission denied
ls: /system/bin//dexoptanalyzer: Permission denied
ls: /system/bin//dnsmasq: Permission denied
ls: /system/bin//drmserver: Permission denied
ls: /system/bin//dumpstate: Permission denied
ls: /system/bin//dun-server: Permission denied
ls: /system/bin//e2fsck: Permission denied
ls: /system/bin//e2fsdroid: Permission denied
ls: /system/bin//engineer_system_shell.sh: Permission denied
ls: /system/bin//flags_health_check: Permission denied
ls: /system/bin//fsck.f2fs: Permission denied
ls: /system/bin//fsck_msdos: Permission denied
ls: /system/bin//fsverity_init: Permission denied
ls: /system/bin//gatekeeperd: Permission denied
ls: /system/bin//gpuservice: Permission denied
ls: /system/bin//gsid: Permission denied
ls: /system/bin//hans: Permission denied
ls: /system/bin//heapprofd: Permission denied
ls: /system/bin//hwservicemanager: Permission denied
ls: /system/bin//hypnusd: Permission denied
ls: /system/bin//idmap: Permission denied
ls: /system/bin//idmap2: Permission denied
ls: /system/bin//idmap2d: Permission denied
ls: /system/bin//incident_helper: Permission denied
ls: /system/bin//incidentd: Permission denied
ls: /system/bin//init: Permission denied
ls: /system/bin//installd: Permission denied
ls: /system/bin//iorapd: Permission denied
ls: /system/bin//iw: Permission denied
ls: /system/bin//junklogcollector: Permission denied
ls: /system/bin//keystore: Permission denied
ls: /system/bin//lmkd: Permission denied
ls: /system/bin//logd: Permission denied
ls: /system/bin//lpdumpd: Permission denied
ls: /system/bin//make_f2fs: Permission denied
ls: /system/bin//mdnsd: Permission denied
ls: /system/bin//mediadrmserver: Permission denied
ls: /system/bin//mediaextractor: Permission denied
ls: /system/bin//mediametrics: Permission denied
ls: /system/bin//mediaserver: Permission denied
ls: /system/bin//memtester_eng: Permission denied
ls: /system/bin//migrate_legacy_obb_data.sh: Permission denied
ls: /system/bin//mke2fs: Permission denied
ls: /system/bin//mmi: Permission denied
ls: /system/bin//mmi_diag: Permission denied
ls: /system/bin//mtpd: Permission denied
ls: /system/bin//netd: Permission denied
ls: /system/bin//netutils-wrapper-1.0: Permission denied
ls: /system/bin//notify_traceur.sh: Permission denied
ls: /system/bin//oae_server: Permission denied
ls: /system/bin//oiface: Permission denied
ls: /system/bin//oppo_kevent: Permission denied
ls: /system/bin//oppo_theia: Permission denied
ls: /system/bin//perfservice: Permission denied
ls: /system/bin//phoenix_log_native_helper.sh: Permission denied
ls: /system/bin//pppd: Permission denied
ls: /system/bin//profman: Permission denied
ls: /system/bin//qspmsvc: Permission denied
ls: /system/bin//quickboot: Permission denied
ls: /system/bin//qvrservice: Permission denied
ls: /system/bin//racoon: Permission denied
ls: /system/bin//recovery-persist: Permission denied
ls: /system/bin//resize.f2fs: Permission denied
ls: /system/bin//resize_ext4: Permission denied
ls: /system/bin//rss_hwm_reset: Permission denied
ls: /system/bin//rutilsdaemon: Permission denied
ls: /system/bin//screenrecord: Permission denied
ls: /system/bin//sdcard: Permission denied
ls: /system/bin//servicemanager: Permission denied
ls: /system/bin//sgdisk: Permission denied
ls: /system/bin//sigma_miracasthalservice: Permission denied
ls: /system/bin//sload_f2fs: Permission denied
ls: /system/bin//statsd: Permission denied
ls: /system/bin//storaged: Permission denied
ls: /system/bin//stressapptest_eng: Permission denied
ls: /system/bin//surfaceflinger: Permission denied
ls: /system/bin//tcpdump: Permission denied
ls: /system/bin//tombstoned: Permission denied
ls: /system/bin//traced: Permission denied
ls: /system/bin//traced_probes: Permission denied
ls: /system/bin//tune2fs: Permission denied
ls: /system/bin//uncrypt: Permission denied
ls: /system/bin//usbd: Permission denied
ls: /system/bin//vdc: Permission denied
ls: /system/bin//viewcompiler: Permission denied
ls: /system/bin//vold: Permission denied
ls: /system/bin//vold_prepare_subdirs: Permission denied
ls: /system/bin//vpsservice: Permission denied
ls: /system/bin//wait_for_keymaster: Permission denied
ls: /system/bin//watchdogd: Permission denied
ls: /system/bin//wfdservice: Permission denied
ls: /system/bin//wificond: Permission denied
ls: /system/bin//wifirftest: Permission denied
QMESA_64
SecrecyAutoUnlocker
abb
acpi
am
app_process
app_process32
app_process64
applypatch
appops
appwidget
atrace
awk
base64
basename
bc
bcc
blockdev
bmgr
bootstrap
bspatch
bu
bugreport
bugreportz
bunzip2
bzcat
bzip2
cal
cat
checkfutexwait
chgrp
chmod
chown
chroot
chrt
cksum
clear
cmd
cmp
comm
content
cp
cpio
crash_dump32
crash_dump64
curl
cut
dalvikvm
dalvikvm32
dalvikvm64
date
dd
debuggerd
defrag.f2fs
device_config
devmem
dexdiag
dexdump
dexlist
df
diff
dirname
dmctl
dmesg
dos2unix
dpm
dsm_ctrl
du
dumpsys
echo
egrep
env
expand
expr
extractCurrentUefiLog
fallocate
false
fgrep
file
find
flock
fmt
free
fsck_exfat
fsync
get-cplc
getconf
getenforce
getevent
getprop
grep
groups
gsi_tool
gunzip
gzip
head
hid
hostname
hw
hwclock
i2cdetect
i2cdump
i2cget
i2cset
iconv
id
ifconfig
ime
incident
init.oppo.bluetooth.sh
inotifyd
input
insmod
install
ionice
iorenice
ip
ip-wrapper-1.0
ip6tables
ip6tables-restore
ip6tables-save
ip6tables-wrapper-1.0
iptables
iptables-restore
iptables-save
iptables-wrapper-1.0
iwlist
iwpriv
keystore_cli_v2
kill
killall
ld.mc
librank
linker
linker64
linker_asan
linker_asan64
ln
load_policy
locksettings
log
logcat
logname
logwrapper
losetup
lpdump
ls
lshal
lsmod
lsof
lspci
lsusb
md5sum
media
microcom
mini-keyctl
minidumpreader
mkdir
mkexfat
mkfifo
mkfs.ext2
mkfs.ext3
mkfs.ext4
mknod
mkntfs
mkswap
mktemp
modinfo
modprobe
monkey
more
mount
mountpoint
move_time_data.sh
move_widevine_data.sh
move_wifi_data.sh
mv
nc
ndc
ndc-wrapper-1.0
netcat
netstat
newfs_msdos
nice
nl
nohup
nproc
nsenter
ntfs-3g
ntfsfix
oatdump
od
oppopnscrcmd
paste
patch
perfetto
pgrep
phoenix_log_manager
pidof
ping
ping6
pkill
pm
pmap
printenv
printf
procrank
ps
pwd
qvrdatalogger
qvrservicetest
qvrservicetest64
readlink
realpath
reboot
remount
renice
requestsync
resize2fs
restorecon
rm
rmdir
rmmod
rtspclient
rtspserver
run-as
runcon
schedtest
screencap
secdiscard
secilc
sed
self-init-system
sendevent
sensorservice
seq
service
setenforce
setprop
setsid
settings
sh
sha1sum
sha224sum
sha256sum
sha384sum
sha512sum
showmap
shutdown_log_back
shutdown_log_native_helper.sh
simpleperf
simpleperf_app_runner
sleep
sm
sort
split
ss
start
stat
stop
strings
stty
svc
swapoff
swapon
sync
sysctl
tac
tail
tar
taskset
tc
tc-wrapper-1.0
tee
telecom
time
timeout
tinycap
tinymix
tinypcminfo
tinyplay
tinyplay_ftm
toolbox
top
touch
toybox
tr
trigger_perfetto
true
truncate
tty
tzdatacheck
ueventd
uiautomator
ulimit
umount
uname
uniq
unix2dos
unlink
unshare
unzip
uptime
usleep
uudecode
uuencode
uuidgen
vmstat
vr
watch
wc
which
whoami
wm
xargs
xxd
yes
zcat

那么,如果想要录屏怎么办?这里推荐一个工具,那就是 scrcpy

安装 (仅 macOS):

brew install scrcpy

如果你没有 adb,则需要先安装:

brew cask install android-platform-tools

运行 scrcpy

安装完毕后,电脑连接手机,执行 scrcpy 可在电脑上面看到手机实时投屏:

scrcpy

录屏

如果想要录屏,执行以下两个命令之一:

scrcpy --record test.mp4
scrcpy -r test.mp4

你也可以在不开启实时镜像显示的情况录屏:

scrcpy --no-display --record file.mp4
scrcpy -Nr file.mkv

更多

详情请查看scrcpy(中文版请看这里->scrcpy

共收到 0 条回复 时间 点赞
需要 登录 后方可回复, 如果你还没有账号请点击这里 注册