android_su
android_su

Reputation: 1687

How can I execute "su" on Android?

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?

Upvotes: 3

Views: 17394

Answers (3)

Chris Stratton
Chris Stratton

Reputation: 40347

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.

Upvotes: 1

Parth Doshi
Parth Doshi

Reputation: 4208

Perhaps you should try How to get root access and execute.

Upvotes: 0

jtt
jtt

Reputation: 13541

If you are being denied root by the system, there is not much you can do aside from rooting the device.

Upvotes: 0

Related Questions