private String install(String apkAbsolutePath) {
    String[] args = {"pm", "install", "-r", apkAbsolutePath};
    ProcessBuilder processBuilder = new ProcessBuilder(args);
    InputStream inputStream = null;
    try {
        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
        int read = -1;
        Process process = processBuilder.start();
        InputStream errIs = process.getErrorStream();
        while ((read = errIs.read()) != -1) {
            outputStream.write(read);
        }
            
        inputStream = process.getInputStream();
        while ((read = inputStream.read()) != -1) {
            outputStream.write(read);
        }
        return new String(outputStream.toByteArray());
    } catch (Exception e) {
        Log.e("llx", e.toString());
    }
    return null;
}

private String uninstall(String szPackage) {
    InputStream inputStream = null;
    String[] args = {"pm", "uninstall", "-k", szPackage};
    ProcessBuilder processBuilder = new ProcessBuilder(args);
    try {
        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
        int read = -1;
        Process process = processBuilder.start();
        InputStream errIs = process.getErrorStream();
        while ((read = errIs.read()) != -1) {
            outputStream.write(read);
        }
            
        inputStream = process.getInputStream();
        while ((read = inputStream.read()) != -1) {
            outputStream.write(read);
        }
        return new String(outputStream.toByteArray());
    } catch (Exception e) {
        Log.e("llx", e.toString());
    }
    return null;
}
注意: 要在/system/app目录下才能执行成功.