Android刷Root方法,zergRush,Odin3+CWM(ClockworkMod recovery)
一:
安裝驅動精靈,裝好手機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;?
??? }?
?
}
總結
以上是生活随笔為你收集整理的Android刷Root方法,zergRush,Odin3+CWM(ClockworkMod recovery)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: vue移动端的一款音频插件vue-apl
- 下一篇: 关于HTTP和HTTPS的区别