Create a file in /system directory

前端 未结 2 462
礼貌的吻别
礼貌的吻别 2021-01-26 18:01

I want to create a file in the /system directory. I think that directory is \"protected\" and the phone must be rooted to access and create to it. I used this simple code to cre

2条回答
  •  醉梦人生
    2021-01-26 18:17

    You need to call following method on file object

    file.createNewFile();
    

    On executing this following error comes because of read-only directory

    11-09 19:45:15.136: E/VideoSample(4245): java.io.IOException: open failed: EROFS 
                        (Read-only file system)
    11-09 19:45:15.136: E/VideoSample(4245):    at 
                         java.io.File.createNewFile(File.java:940)
    

提交回复
热议问题