java.io.IOException: Error running exec(). Commands: [cd, sdcard/.yasmin] Working Directory: null Environment: null
I am not sure that this will fix your problem, but AFAIK, each call to exec()
creates a new shell. A possible solution is to do the following:
- Get the process of the exec() using:
Process p = Runtime.getRuntime().exec(...)
. - Grab the process inputStream using
p.getInputStream();
. - Run the second command.
also note that you are trying to access the sdcard as you were in root folder and in a hardcoded path, consider the following:
Process p = Runtime.getRuntime().exec("cd /sdcard/.yasmin");
Or even better:
Process p = Runtime.getRuntime().exec("cd " + Environment.getExternalStorageDirectory() + "/.yasmin");
Hope it'll help!
you should use Runtime.getRuntime().exec("sh -c cd /sdcard/.yasmin");