all
here is my problem,I want to start an android TestProject in my app,but I don’t konw how,and I found that I can start it with command ,e.g. “adb shell am instrument -w com.demo.test/android.test.InstrumentationTestRunner”
So I have tried use in my app :Runtime.getRuntime().exec(“adb shell am instrument -w com.demo.test/android.test.InstrumentationTestRunner”);but have:
03-15 02:24:42.246: WARN/System.err(3597): java.io.IOException: Error running exec(). Command: [adb, shell, am, instrument, -w, com.demo.test/android.test.InstrumentationTestRunner] Working Directory: null Environment: null
…..
03-15 02:24:42.246: WARN/System.err(3597): Caused by: java.io.IOException: Permission denied
where is my problem?
There is already an API for this, Context.startInstrumentation:
This is how the shell command is implemented. You can’t do anything more by launching a shell command than you can do in your own process. Also, no shell commands are part of the SDK, so anything you do with it is likely to break at some point on different devices or versions of the platform.