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 / 这个命令让/路径文件系统为可读写模式,即系统重新挂载一次。

    你只管学习,上天会负责考量。
  • 相关阅读:
    组装query,query汇总,query字段
    POJ 1276, Cash Machine
    POJ 1129, Channel Allocation
    POJ 2531, Network Saboteur
    POJ 1837, Balance
    POJ 3278, Catch That Cow
    POJ 2676, Sudoku
    POJ 3126, Prime Path
    POJ 3414, Pots
    POJ 1426, Find The Multiple
  • 原文地址:https://www.cnblogs.com/kechen/p/13353718.html
Copyright © 2011-2022 走看看