이와 비슷한 기능이 작동합니다. 코드는 수퍼 유저 액세스
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();
File file=new File("/system/build.prop");
읽기
FileInputStream fis = openFileInput("/system/build.prop");
String content = "";
byte[] input = new byte[fis.available()];
while (fis.read(input) != -1) {}
content += new String(input);
편집 String content
여기를 제출 요청 일부 변경
을 테스트되지 않았으며해야 할 수도 있습니다.
쓰기 파일
DataOutputStream outstream= new DataOutputStream(new FileOutputStream(file,false));
String body = content;
outstream.write(body.getBytes());
outstream.close();
당신의 build.prop가에-경우 뭔가 편집 중에 잘못 백업해야합니다.
응용 프로그램에 확실하게 루트 액세스 권한이 있습니까? –