1

I am trying to update an Apk on Android Remotely. To run the update without the need of user intervention, I am using this post Link .

But the process is returning with the exit code 139 which means Segmentation fault. My tablet is rooted and I have confirmed it.

File file = new File(Constants.UPDATE_APK_PATH);
    try {
        String[] filenames = file.list();
        File apk = new File(file, filenames[0]);
        Process pid = Runtime.getRuntime().exec(
                new String[] { "su", "-c",
                        "pm install -r "+apk.getAbsolutePath()});
        pid.waitFor();

Can anybody tell what exactly i am doing wrong? The file is present at the location and the signature of both the apk is same.

Community
  • 1
  • 1
jeevs
  • 261
  • 6
  • 20

1 Answers1

1

I'm pretty sure if you use adb install instead of pm install would resolve this issue. But i believe in this case application does not have enough permissions to install packages.

blganesh101
  • 3,647
  • 1
  • 24
  • 44
  • How can execute adb from activity?? I have already added these permissions "android.permission.FACTORY_TEST", "android.permission.INSTALL_PACKAGES", "android.permission.DELETE_PACKAGES". Can you tell which i have missed?? – jeevs Jul 19 '13 at 19:52
  • you don't need these permissions for executing shell commands. In your above code replace pm with adb – blganesh101 Jul 20 '13 at 07:10
  • The adb also didn't work. Now the exit code for the process is 1. – jeevs Jul 20 '13 at 13:30