简体   繁体   English

根权限未授予Android应用执行“ su”命令的权限

[英]Root permission not granted to Android app for exceuting “su” command

I want to execute the "su" comand from an app..I have rooted the emulator and installed Superuser.apk(superuser 2.3.6.1) 我想从一个应用程序执行“ su”命令。我已经植根了模拟器并安装了Superuser.apk(superuser 2.3.6.1)

Process pr= Runtime.getRuntime().exec("su");
process.waitFor();
Log.d("Ex.Value",Integer.toString(process.exitValue()));

But I'm getting 255 as the exit value which seems to be some error in executing "su". 但是我得到255作为退出值,这似乎在执行“ su”时出错。 I have included RootTools library ( http://code.google.com/p/roottools/ ). 我已经包含了RootTools库( http://code.google.com/p/roottools/ )。 When checked with the methods RootTools.isRootAvailable(), RootTools.isAccessGiven() ...Its found that the emulator has SU, but my application is not granted Root permissions. 使用方法RootTools.isRootAvailable(),RootTools.isAccessGiven()进行检查时...发现仿真器具有SU,但未向我的应用程序授予Root权限。 Will it be the real issue?? 会是真正的问题吗? ..If so Can you plz tell how to grant my app the Root permission? ..如果是这样,您能告诉我如何授予我的应用“根”权限吗?

When you execute 'su', you should have root access within that process. 当执行“ su”时,您应该在该进程中具有root用户访问权限。 The app should then automatically ask for root permission to the user via a dialog box. 然后,该应用应通过对话框自动向用户请求root权限。 This dialog box is provided by android but is only present in devices that have been rooted. 此对话框由android提供,但仅在已植根的设备中存在。

This blog post has an example that might help you: 此博客文章中的示例可能会为您提供帮助:

http://www.stealthcopter.com/blog/2010/01/android-requesting-root-access-in-your-app/ http://www.stealthcopter.com/blog/2010/01/android-requesting-root-access-in-your-app/

The comments at the end are very informative as well. 最后的评论也很有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM