Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/202.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
无法替换Android根设备中/system/fonts文件夹中的文件_Android_Rooted Device - Fatal编程技术网

无法替换Android根设备中/system/fonts文件夹中的文件

无法替换Android根设备中/system/fonts文件夹中的文件,android,rooted-device,Android,Rooted Device,我尝试用/sdcard中的myfont.ttf替换DroidSansFallback.ttf,如下所示 try { Process p = Runtime.getRuntime().exec("su"); DataOutputStream outs=new DataOutputStream(p.getOutputStream()); outs.writeBytes("mount -o rw,remount /system"+"\n");

我尝试用/sdcard中的myfont.ttf替换DroidSansFallback.ttf,如下所示

    try {
        Process p = Runtime.getRuntime().exec("su");
        DataOutputStream outs=new DataOutputStream(p.getOutputStream());
        outs.writeBytes("mount -o rw,remount /system"+"\n");
        outs.writeBytes("cat /sdcard/myfont.ttf >> /system/fonts/DroidSansFallback.ttf"+"\n");
        outs.writeBytes("mount -o rw,remount /system"+"\n");
        outs.flush();
    } catch (IOException e) {
        e.printStackTrace();
    }
我可以通过这种方式将DroidSansFallback复制到/sdcard,但无法复制回。 如果您知道在根设备中替换DroidSansFallback字体的正确方法,请提供帮助。

您可能对
/system/font

请尝试以下内容:

Process proc = Runtime.getRuntime().exec(new String[] { "su", "-c", "chmod 777 /system/font" });
// I have used 777 just for testing you can change as per your requirement
proc.waitFor();  

首先,这通常是个坏主意。但是一个明显的问题是,当您可能需要一个简单的重定向“>”时,您正在使用append操作符“>>”。其他的问题是,如果你有一个被黑客攻击的
su
可以用这种方式使用,并且如果你的设备的硬件对解锁系统分区进行写入有额外的要求(linux之外)。谢谢!这是工作!使用>>时我的坏习惯。请回答我的问题!