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 am running "adb root" in my terminal

 :~/android/android-sdk/platform-tools$ ./adb root adbd is already running as root 

Any ideas?

+3
source share
3 answers

It looks like your adb is running as root, but you only have the su tool. You can use adb to replace it of your choice.

Either this, or you have it configured, and it was not configured so that this user ID of the application you are working with is in this case you need to open its configuration tool and change it.

Pay attention . This is the old answer to the old question - it was several versions of Android, since regular su no longer possible on regular Android versions for end users due to the adoption of SELinux. Workarounds far from exhaust this issue.

+1
source

If you are denied the root system, you cannot do without rooting the device.

0
source

Perhaps you should try How to root and execute .

0
source

Source: https://habr.com/ru/post/1447428/


All Articles