zoukankan      html  css  js  c++  java
  • ADB:运行adb shell uiautomator dump并查看dump文件,由于权限问题报错的解决办法

    (把实践过程中的大坑小坑……都记下来,每天进步一点点)

    环境:win10,夜神模拟器v6.6.0.9,adb v1.0.41,gitbash

    运行命令:adb shell "uiautomator dump && cat /storage/emulated/legacy/window_dump.xml"
    出现报错/bin/sh:xx(命令) not found

    常见的原因是权限不够,可以先查看/storage/emulated/legacy的权限情况。

    执行adb shell命令,进入上面目录:

    $ adb shell
    root@shamu:/ # cd /storage
    cd /storage
    root@shamu:/storage # ll
    ll
    dr-xr-xr-x root     root              2020-07-21 08:56 emulated
    lrwxrwxrwx root     root              2020-07-21 08:56 sdcard0 -> /storage/emulated/legacy
    

    修改emulated目录权限为777,出现Read-only file system报错:

    root@shamu:/storage # chmod 777 emulated
    chmod 777 emulated
    Unable to chmod emulated: Read-only file system
    

    这个时候我们先回到根目录,执行命令mount -o remount rw /,再重新为emulated设置777的权限:

    root@shamu:/ # mount -o remount rw /
    mount -o remount rw /
    root@shamu:/ # cd /storage
    cd /storage
    root@shamu:/storage # ll
    ll
    dr-xr-xr-x root     root              2020-07-21 08:56 emulated
    lrwxrwxrwx root     root              2020-07-21 08:56 sdcard0 -> /storage/emulated/legacy
    root@shamu:/storage # chmod 777 emulated
    chmod 777 emulated
    root@shamu:/storage # ll
    ll
    drwxrwxrwx root     root              2020-07-21 08:56 emulated
    lrwxrwxrwx root     root              2020-07-21 08:56 sdcard0 -> /storage/emulated/legacy
    

    可以看到emulated已经是rwx的权限了。

    这个时候,再重新查看dump文件就没问题了。

    P.S.
    mount –o remount rw / 这个命令让/路径文件系统为可读写模式,即系统重新挂载一次。

    你只管学习,上天会负责考量。
  • 相关阅读:
    洛谷P3819 松江1843路
    洛谷P1896 [SCOI2005]互不侵犯King
    洛谷P1197 [JSOI2008]星球大战
    洛谷P1171 售货员的难题
    2017-10-24 NOIP模拟赛
    LibreOJ #6192. 「美团 CodeM 复赛」城市网络
    洛谷P2258 子矩阵
    Cogs 9. 中心台站建设
    Cogs 6. 线型网络
    洛谷P3138 [USACO16FEB]负载平衡Load Balancing_Silver
  • 原文地址:https://www.cnblogs.com/kechen/p/13353718.html
Copyright © 2011-2022 走看看