android包管理器无法与ICS一起使用

时间:2012-06-15 17:53:45

标签: android linux shell adb

在4.0之前,它正常工作,但在4.0之后,我无法像“pm uninstall com.abc”那样运行它

我的代码是这样的:

try {
                // Executes the command.
                Process process = Runtime.getRuntime().exec("pm uninstall me.onemobile.android");
                DataOutputStream toProcess = new DataOutputStream(process.getOutputStream());
                toProcess.writeBytes("exec " + "shell pm uninstall me.onemobile.android" + "\n");
                toProcess.flush();
            } catch (IOException e) {
                System.out.println(e.getMessage());
                throw new RuntimeException(e);
            }

当我运行它时,它显示如下:

[1] + Stopped (signal)

当我在root中运行“pm uninstall com.test”时,有一些区别,它只显示

[1] + Stopped (signal)

但是当运行“adb shell pm uninstall com.test”时,这是有效的,所以它让我发疯了。

任何帮助或提示都将受到赞赏。

2 个答案:

答案 0 :(得分:1)

试试此代码

  toProcess.writeBytes("export LD_LIBRARY_PATH=/vendor/lib:/system/lib" + "\n"); 
  toProcess.writeBytes("exec " + "shell pm uninstall me.onemobile.android" + "\n"); 
  toProcess.flush(); 

答案 1 :(得分:0)

我在android 4.0.3中遇到了同样的问题。 运行'adb su'后,'pm'总是返回[1] +停止(信号)。 这似乎是由特权造成的。