0

我想使用 Java 运行时运行 aapt。我的代码如下:

String srcFile = "/home/jay/testing_FILES.apk";
String dsFile = "/home/jay/testing_FILES";
String firstCommand =  ("/home/jay/android-sdk-linux/platform-tools/aapt " +
    "package -u -f -F" + srcFile + dsFile);
try {
  Runtime rt = Runtime.getRuntime();
  Runtime.getRuntime().exec(firstCommand);
} catch (IOException e1) {
  e1.printStackTrace();
}

这段代码没有给我错误,但也没有给我任何结果。关于如何解决这个问题的任何想法?这也意味着是可移植的代码,所以如果有一种方法可以在没有脚本的情况下完成它,那将是首选。

4

1 回答 1

0

You are trying to put the arguments in the same string as the command; that won't work here because there is no shell to parse them out.

You might want to try the form of exec() which takes a string array containing a command and it's arguments.

于 2012-07-17T20:40:30.073 回答