I try to access to my folder in sdcard and install myapp.apk, i use this code:
Runtime.getRuntime().exec("cd sdcard/.yasmin");
Runtime.getRuntime().exec("adb install tefli.apk");
But unfortunatelly i have this error:
05-11 11:09:57.925: WARN/System.err(1399): java.io.IOException:
Error running exec(). Commands: [cd, sdcard/.yasmin] Working Directory: null Environment: null
Anybody please have an idea.
thanks in advance.
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:Process p = Runtime.getRuntime().exec(...).p.getInputStream();.also note that you are trying to access the sdcard as you were in root folder and in a hardcoded path, consider the following:
Or even better:
Hope it’ll help!