/system/bin/sh: screenrecord: inaccessible or not found 報錯解決方案

xiaoxiao發表於2020-11-06

在我們平時測試工作中,可能需要對 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

相關文章