The back of the pile of garbled so I know had to use Google to check the answer to the question, turned upside down on the Enlightenment.
First oneself in how to get the APK information, and then learned about the Processbuilder class, specific how to get the APK information, I also wrote an analysis of this kind of article:
public class Testprocess {public static void main (string[] args) {Processbuilder PB = new Processbuilder ();p B.redirecterro Rstream (true); try {Process p = pb.command ("C:/getapkinfo/aapt.exe D badging d:/new/test.apk"). Start (); BufferedReader br = new BufferedReader (New InputStreamReader (P.getinputstream (), "UTF-8")); String s = ""; while ((S=br.readline ()) = null) {SYSTEM.OUT.PRINTLN (s);}} catch (IOException e) {e.printstacktrace ();}}}
When the code was executed, it was reported
Java.io.IOException:Cannot Run Program "C:/getapkinfo/aapt.exe D": CreateProcess error=2,????? μ???
The error.
But it is possible to execute directly in a DOS window.
Change the code to
Process p = pb.command ("ipconfig"). Start ();
is performed normally. A whole bunch of answers to the back are all path problems. No, it's the wrong solution.
The Processbuider API is written to the it is not checked whether command
corresponds to a valid operating system command. is not a system instruction and does not prompt.
Then inspired by an online answer and source, I tried to change the code to:
Process p = Pb.command ("C:/getapkinfo/aapt.exe D", "badging", "d:/new/test.apk"). Start ();
Yes, this is normal execution.
Why is it?
It seems that instructions are not recognized if there is a space between instructions without a separate string.
Process p = pb.command ("C:/getapkinfo/aapt.exe", "", "D", "badging", "d:/new/test.apk"). Start ();
This is normal execution, but the result of this execution is equivalent to typing in the DOS window: C:/getapkinfo/aapt.exe.
Then, the Ipconfig/all is able to output the details of the IP address.
But instead:
Process p = pb.command ("ipconfig//all"). Start ();
also reported the same mistake, here everyone will know where the error is.
There are spaces in the instruction that need to be separated by different strings.
Re-read the API for this method.
Public processbuilder command (String ... command)
command
-A string array containing the program and its arguments
The visible directives and parameters are placed in a different string array, so the following will execute normally:
Process p = pb.command ("C:/getapkinfo/aapt.exe", "", "D", "badging", "d:/new/test.apk"). Start ();
Processbuilder abnormal CreateProcess error=2,?? Õ?» µ½?¶