简体   繁体   中英

Execute shell script from android studio

I'm writing some tests in Android Studio with Robotium. In my test file I'd like to execute a shell script that prepares the right environment on our server. I don't work in Java/AndroidStudio so this is completely new territory. Is it possible to execute a shell script?

I found some code, but java doesn't recognize commandLine

commandLine 'sh', './myScript.sh'

Any help greatly appreciated.

ProcessBuilder pb = new ProcessBuilder("myshellScript.sh", "myArg1", "myArg2"); will do the trick

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM