PackageManager没有安装应用程序

时间:2015-06-02 14:46:44

标签: android install package-managers su

我有根植的Android平板电脑。我使用SuperUser执行PackageManager以根据需要偶尔安装更新。

最近,更新已停止在平板电脑上安装。研究表明,该过程会返回成功的安装响应:

apk = apkName;

String command = "pm install -r "+apkDirectory+apkName +" \n";
process = Runtime.getRuntime().exec("su");
DataOutputStream os = new DataOutputStream(process.getOutputStream());  
os.writeBytes(command);  
os.writeBytes("exit\n"); 
os.flush();
InputStream stdin = process.getInputStream();
InputStreamReader isr = new InputStreamReader(stdin);
BufferedReader br = new BufferedReader(isr);
String line = null;
Log.d("OTAApp", "Install output..");
StringBuffer strBuffer = new StringBuffer();
while ( (line = br.readLine()) != null){
    strBuffer.append(line);
}
Log.d("OTAApp", strBuffer.toString());

int exitVal = process.waitFor();

Log.d("OTAApp", "Installing done for: "+apkName+"... process exitValue: "+ exitVal);

Log.d("OTAApp", "All Installs done");

logcat的:

06-02 09:30:26.523: D/OTAApp(12439): Now Installing short...
06-02 09:30:26.593: D/OTAApp(12439): Install output..
06-02 09:30:27.484: D/OTAApp(12439): Installing done for: short.apk... process exitValue: 0
06-02 09:30:27.484: D/OTAApp(12439): launching short...
06-02 09:30:27.744: D/OTAApp(12439): All Installs done

这里可能会发生什么?平板电脑没有应用操作系统更新。平板电脑是Verizon品牌的三星SCH-i705 LTE。操作系统是Android 4.1.2。如前所述,平板电脑是root用户,调用SU的软件具有root权限,应该可以安装应用程序。

非常感谢任何帮助?

0 个答案:

没有答案