一:
安装驱动精灵,装好手机USB驱动,重启电脑(CWM刷ROOT这步很重要);手机连上电脑,打开android DEBUG模式。
二:
zergRush用于对Android手机进行root提权, 适用于android 2.2/2.3版本,代码可以从下面这个网址获得:
??????????????????????????????????????
https://github.com/revolutionary/zergRush/downloads
现在的破解很多都是用zergRush或者GingerBreak的,两者比较类似,原理好像都差不多SuperOneClick也是集成了这两个核心的。
不过这种不是适合所有的机型,比如zergRush是失败就会出现”Hellions with BLUE flames !”,
命令如下:
adb shell rm -r /data/local/tmp
adb shell mkdir /data/local/tmp
adb push .\zergRush /data/local/tmp
adb shell chmod 755 /data/local/tmp/zergRush
adb shell /data/local/tmp/zergRush
adb remount
?
adb push .\su /system/bin
adb push .\su /system/xbin
adb shell chmod 4755 /system/bin/su
adb shell chmod 4755 /system/xbin/su
如果失败的话,只能采用刷ROM方法。
三:
做好步骤1准备操作,开启fastboot模式,每款机器不太一样,开启Odin3,如果能识别USB,然后勾上PDA,点击开始就搞定,前提是你得下载正确的ROM,如果所刷的ROOT内核和ROM不匹配会有黄三角。
可参考http://bbs.gfan.com/android-3673980-1-1.html
?
应用程序获取ROOT权限:
?
public class DemoActivity extends Activity {?
??? public final String rootPowerCommand = "chmod 777 /dev/block/mmcblk0";// 授权root权限命令?
??? /** Called when the activity is first created. */?
??? @Override?
??? public void onCreate(Bundle savedInstanceState) {?
??????? super.onCreate(savedInstanceState);?
??????? setContentView(R.layout.main);?
?????? new AlertDialog.Builder(this).setMessage(rootCommand(rootPowerCommand)+"....").show();?
?????? File []files =? new File("/root").listFiles();?
?????? if(files==null){//<strong><span style="font-size:18px;color:#ff0000;">说明是NULL。。。。就是不能访问其下的文件了?
</span></strong>?????????? new AlertDialog.Builder(this).setMessage(".OK...").show();?
?????? }?
????? // files[0].getName();?
??? }?
??? /**?
???? * 授权root用户权限?
???? *??
???? * @param command?
???? * */?
??? public boolean rootCommand(String command) {?
??????? Process process = null;?
??????? DataOutputStream dos = null;?
??????? try {?
??????????? process = Runtime.getRuntime().exec("su");?
??????????? dos = new DataOutputStream(process.getOutputStream());?
??????????? dos.writeBytes(command + "\n");?
??????????? dos.writeBytes("exit\n");?
??????????? dos.flush();?
??????????? process.waitFor();?
??????? } catch (Exception e) {?
??????????? return false;?
??????? } finally {?
??????????? try {?
??????????????? if (dos != null) {?
??????????????????? dos.close();?
??????????????? }?
??????????????? process.destroy();?
??????????? } catch (Exception e) {?
??????????? }?
??????? }?
??????? return true;?
??? }?
?
}