不止一个超级用户命令的Android [英] More than one Superuser command Android
本文介绍了不止一个超级用户命令的Android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我特林运行这样的:
String[] hin1 = { "su", "-c",
"mount -o remount,rw -t yaffs2 /dev/block/mtdblk3 /system" };
try {
Runtime.getRuntime().exec(hin1);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
String[] hin2 = { "su", "-c", "m /system/etc/hosts" };
try {
Runtime.getRuntime().exec(hin2);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
String[] hin = { "su", "-c",
"cp /sdcard/hosts /system/etc/" };
try {
Runtime.getRuntime().exec(hin);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
可悲的是它只是工作时我做的每一个动作一个新的按钮..:(
Sadly it is only working when I make for every action a new button.. :(
有没有一种方法可以一次运行多个命令??
Is there a way to run more than one command at once??
感谢
推荐答案
别以为这样的工作也有,我试过以下code:
Don't think so its working also , I tried the following code :
public class GainrootActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
public void gainroot(View view)
{
String[] hin1 = { "su", "-c","chmod 777 dev/test1" };
try {
Runtime.getRuntime().exec(hin1);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
仅按钮su命令-c搭配chmod 777开发/测试1(改变一个日志文件的权限在dev目录),但没有奏效。
请告诉我错在this.Can有人点破什么缺失。
我甚至把这个线在AndroidManifest.xml以及
only button for command su -c chmod 777 dev/test1 (for changing the permission of one log file in dev directory) but it didn't work. Whats wrong in this.Can some one point out whats missing. I have even put this line in the Androidmanifest.xml as well
<uses-permission android:name="android.permission.ACCESS_SUPERUSER" />
RGDS,
SAURABH
Rgds, Saurabh
这篇关于不止一个超级用户命令的Android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文