Search code examples
androidlinuxshelladb

android package manager can not work with ICS


Before 4.0,It's work normally, but after 4.0,I can't run it like "pm uninstall com.abc"

my code like this:

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);
            }

when I run it,it's show like this:

[1] + Stopped (signal)

There some difference when i run "pm uninstall com.test" in root,and it just show

[1] + Stopped (signal)

but when run "adb shell pm uninstall com.test" ,It's work, so it's make me crazy.

any help or hint will be appreciate.


Solution

  • Try this code

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