首页 > 读取错误?Error running exec(). Command: [/system/xbin/su]

读取错误?Error running exec(). Command: [/system/xbin/su]

java.io.IOException: Error running exec(). Command: [/system/xbin/su] Working Directory: null Environment: null
``

public SerialPort(File device, int baudrate, int flags) throws SecurityException, IOException {

    if (!(device.canRead() && device.canWrite())) {
        try {
            Process su = Runtime.getRuntime().exec("/system/bin/su");
            su.getOutputStream().write(new StringBuilder("chmod 06755 ").append(device.getAbsolutePath()).append("\n").append("exit\n").toString().getBytes());
            if (!(su.waitFor() == 0 && device.canRead() && device.canWrite())) {
                throw new SecurityException();
            }
        } catch (Exception e) {
            e.printStackTrace();
            throw new SecurityException();
        }
    }
【热门文章】
【热门文章】