$ adb shell CLASSPATH=/data/app/com.example.helloworld-1.apk exec app_process /system/bin com.example.helloworld.Console --help
Usage of helloworld:
-h, --help print this message
-v, --version show current version
... other ...
if (cmd.hasOption("version")) {
formatter.printHelp(PROCESS_NAME, options);
return;
}
if (cmd.hasOption("version")) {
System.out.println(VERSION);
return;
}
}
然后代码的上部加入import org.apache.commons.cli.*;
编译,然后安装到手机上,试试效果
$ adb shell CLASSPATH=/data/app/com.example.helloworld-2.apk exec app_process /system/bin com.example.helloworld.Console --help
usage: helloworld.cli
-h,--help show this message
-v,--version show current version