1

I am trying to uninstall an app from a device through ADB in Java code, and I am getting following issues while doing so.

Here is the APK name that contains the package:

Process p = Runtime.getRuntime().exec(new String[]{"sh","-c","./adb shell su -c 'pm uninstall "+apkName+"'"});

I got the following message in the log:

Uninstalling : com.foxit.mobile.pdf.lite
..
Running : ./adb shell su -c 'pm uninstall com.foxit.mobile.pdf.lite
'
..
Command Status : Segmentation fault 

For the one who marked it as duplicate, please look into the question clearly. This link explains how to uninstall app from shell but actually I am facing the problem while doing the same through Java code. I am creating a UI in Java for uninstalling apps in a device, and I'm stuck with the problems I have posted here.

Community
  • 1
  • 1
Software Sainath
  • 1,040
  • 2
  • 14
  • 39
  • `Runtime().exec(new String[]{"sh", "-c", "./adb", "shell", "su 0 pm uninstall " + apkName.trim()});` – Alex P. Nov 13 '14 at 11:41
  • hii Alwx thanks for reply i have changed the same but getting status UnknownFailure – Software Sainath Nov 13 '14 at 11:45
  • 1
    Is this working if you execute the ADB command from a shell prompt, and only failing if you do it from the Java code? If it fails from a shell prompt as well, then although you're using Java, I'd say this is a better question for [android.se]. If it works from a shell prompt but fails from Java, then it's appropriate for this site. – Adi Inbar Nov 17 '14 at 05:16

0 Answers0