我试图在Process
的帮助下从java执行adb shell命令 String command = "adb shell dumpsys battery | findstr status";
Process ps = Runtime.getRuntime().exec(command);
返回 / system / bin / sh:findstr:not found
如果我从命令提示符和 python脚本运行相同的命令,它会显示预期的结果。
答案 0 :(得分:2)
您无法在移动设备上运行adb,并且findstr命令仅在Windows上为AFIK。在shell中的机器人构建中不允许使用linux等效的grep,因此您只需执行dumpsys battery
并使用您自己的代码过滤相关部分。