I use Appium to do the android automation testing with Java, when I run the command cmd.exe /c adb shell getprop ro.build.version.release
in Java, the test script is hanging.
Env:
Appium: 1.8,
Android Emulator: android 8,
Platform: Windows 7,
Here is the original code:
public static String main(final String strCmd) throws Exception {
String cmdResult = excuteCmd("adb shell getprop ro.build.version.release");
}
public static String excuteCmd(final String strCmd) throws Exception {
String resultLine;
String resultCmd = "";
try {
Process process = Runtime.getRuntime().exec(strCmd);
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(process.getInputStream()));
while ((resultLine = bufferedReader.readLine()) != null) {
System.out.println(resultLine);
if (!(resultLine.equalsIgnoreCase(""))) {
resultCmd = resultLine;
}
}
process.destroy();
} catch (Exception e) {
e.printStackTrace();
}
System.out.println(resultCmd);
return resultCmd;
}
Here is the original code:
Can anyone help on this issue?