process = Runtime.getRuntime().exec("su");
os = new DataOutputStream(process.getOutputStream());
os.writeBytes(command + "\n");
os.writeBytes("exit\n");
os.flush();
process.waitFor();
The system says:"07-06 11:01:34.337: I/System.out(3864): su: uid 10170 not allowed to su"
I execute "adb root" in my terminal
:~/android/android-sdk/platform-tools$ ./adb root
adbd is already running as root
Any ideas?
It looks like your adb is running as root, but you only have the stock 'su' tool. You could use adb to replace it with a customized one of your choice.
Either that, or you do have a customized one and it's been configured not to allow this application userid you are running under - in that case, you need to open its configuration tool and change this.
Please note - this is an old answer to an old question - it's been several Android versions since a conventional su
stopped being possible on typical end-user Android builds due to the SELinux adoption. Workarounds are far beyond the scope of this question.