Skip to content Skip to sidebar Skip to footer

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

Solution 1:

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.

Solution 2:

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

Solution 3:

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

Post a Comment for "How Can I Execute "su" On Android?"