在Android应用程序来编辑只读文件挂载R / W系统应用程序、编辑、文件、系统

2023-09-06 21:58:28 作者:草莓秋葵脆

我怎么能在我的应用程序,编辑文件/系统/目录?

How can i within my application, to edit a file in /system/ Directory?

我必须使系统R / W写?

I have to make the system R/W write?

我已经试过:

process = Runtime.getRuntime().exec("su");
os = new DataOutputStream(process.getOutputStream());
os.writeBytes("mount -o remount,rw /system\n");
os.writeBytes("exit\n");
os.flush();
process.waitFor();

和很多很多很多人,都没有成功。

and many many many others, without success.

如果有人能帮助我,我非常AP preciated吧! :) 另外,如果我终于成功了,它将适用于所有扎根电话? 或者在某些手机是不同的?

If anybody can help me, i greatly appreciated it! :) Also, if i finally made it, it will apply to all rooted phones? Or in some phones it's different?

推荐答案

我使用的:

    os.writeBytes("mount -o remount rw /system/\n"); 
    //instead of a comma, I have a space. 
    //When I tried it with a comma, mine didn't work either.

这使我能够顺利安装。

And that allows me to successfully mount.

如果您之后退出的权利,当然这是行不通的。你必须要保持相同的进程中,并使用Linux命令编辑文件。

If you exit right after that, of course it will not work. You have to stay within the same process and use the linux commands to edit the file.

我不知道如何编辑这些文件,但我建议使用Google如何做事的Linux终端,然后把正确的code。在 os.writeBytes(code_HERE );

I have no idea how to edit the files, but I suggest googling how to do things in linux terminal, and then putting the proper code in os.writeBytes("CODE_HERE");

不过,只要在安装过程来讲,我不知道是否该命令将工作普遍。这可能只是幸运的是我的设备上运行。

Though, as far as the mounting process is concerned, I don't know if that command will work universally. It may just fortunately work on my device.

编辑: 我现在用RootTools:http://$c$c.google.com/p/roottools/downloads/list 这里是Wiki页面: HTTP://$c$c.google.com/p/roottools/w/list

I now use RootTools: http://code.google.com/p/roottools/downloads/list And here is the Wiki page: http://code.google.com/p/roottools/w/list

不过,我现在使用:

RootTools.remount(file, mountType);
//For example:
RootTools.remount("/system/", "rw");

我认为是普遍的。

I believe that is universal