我正在尝试使用 super 用户修改另一个应用程序的 SharedPreferences。
这是我的做法:
Process suProcess = Runtime.getRuntime().exec("su");
DataOutputStream os = new DataOutputStream(suProcess.getOutputStream());
os.writeBytes("echo \"<?xml version='1.0' encoding='utf-8' standalone='yes' ?><map><string name='commentAuthorName'>toto</string></map>\" > /data/data/com.adobe.reader/shared_prefs/com.adobe.reader.preferences.xml' \n");
os.writeBytes("exit\n");
os.flush();
os.close();
suProcess.waitFor();
但是我的应用程序卡住了。
我做错了什么?
此外,是否有更好的方法来修改我不拥有的另一个应用程序的 SharedPreferences?
提前致谢。
扎布
最佳答案
尝试删除 preferences.xml 之后行尾的单引号。
关于android - 使用 super 用户更改另一个应用程序的 SharedPreferences,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12979388/