1

我正在尝试使用超级用户来修改另一个应用程序的 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 ?

提前致谢。

扎布

4

2 回答 2

1

尝试在preferences.xml 之后删除行尾的单引号。

于 2012-10-19T17:37:38.123 回答
0

好的,我现在知道为什么我的应用程序冻结了(准确地说,它冻结在:Process suProcess = Runtime.getRuntime().exec("su");)。

我正在开发的应用程序是 AIR for Android 的本机扩展。我正在从 Flash builder 启动我的应用程序,显然,这会导致冻结...

从设备正常启动应用程序时,一切正常。

于 2012-10-20T09:03:26.647 回答