0

I want to run aapt using the Java runtime. My code is as follows:

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();
}

This code doesn't give me an error, but it doesn't give me any results either. Any thoughts on how to fix this? Also this is meant to be portable code so if there is a way to do it without scripting that would be preferred.

Random Human
  • 946
  • 1
  • 14
  • 31
JJJ1106
  • 57
  • 2
  • 8

1 Answers1

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.

Chris Stratton
  • 39,853
  • 6
  • 84
  • 117