mumu模擬器安裝xposed--如何在android模擬器上進行root


問題描述

  安裝xposed表示failed to access root權限,新版的mumu模擬器沒有了root選項,需要自己root。

 

1.先關掉應用兼容性,然后重啟

  電腦一般都是x86的,mumu模擬器的本地命令其實都是這個格式的。可如下進行查看

#鏈接模擬器
>adb connect 127.0.0.1:7555 * daemon not running; starting now at tcp:5037 * daemon started successfully connected to 127.0.0.1:7555
#隨便從模擬器系統路徑下取回一個命令文件,這里選擇mv命令 >adb pull /system/bin/mv c:\apk\mv /system/bin/mv: 1 file pulled. 5.0 MB/s (415716 bytes in 0.079s)
#查看其ELF Header,其
Machine值是Intel 80386
>readelf -h c:\apk\mv

ELF Header:
  Magic:   7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
  Class:                             ELF32
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              DYN (Shared object file)
  Machine:                           Intel 80386
  Version:                           0x1
  Entry point address:               0x6030
  Start of program headers:          52 (bytes into file)
  Start of section headers:          414556 (bytes into file)
  Flags:                             0x0
  Size of this header:               52 (bytes)
  Size of program headers:           32 (bytes)
  Number of program headers:         9
  Size of section headers:           40 (bytes)
  Number of section headers:         29
  Section header string table index: 28

 

  兼容性設置讓只支持arm架構的應用也能安裝在模擬器上,但是裝xposed的過程里將會往模擬器 /system/bin或/system/xbin里復制一些新的命令,這些命令有些是通過XposedInstaller安裝的,而XposedInstaller是根據檢測出來的系統架構選擇相對的命令進行安裝的,打開兼容性時XposedInstaller認為系統的架構是arm,這樣安裝的命令是不能在模擬器上執行的。

 

2.對模擬器進行root

  mumu模擬器可用很多真機需要root才能用的命令,比如pull,但是其其實是沒root的。沒root其實就是沒有su命令,不能通過su獲得root權限,root其實是linux的一個用戶。這里安裝supersu2.82.apk,安裝后打開顯示沒有su命令,這個應用其實是管理其它應用的,當其它應用需要root權限時跟它申請,它會跳出對話框讓你選擇是否同意。但現在supersu也沒有root權限,這是因為模擬器里就沒有su這個命令。下載supersu對應的Recovery Flashable.zip,這里頭有各種架構下的su命令,目標就是選擇適合的su命令復制到模擬器可執行目錄下。具體做法如下

#選擇x86文件夾下的su.pie復制到 /system/xbin/su
#經測試復制到/system/bin/su不行
#選擇su.pie是因為mumu模擬器是android 6.0屬於較高版本
>adb push c:\SuperSU-v2.82-201705271822\x86\su.pie /system/xbin/su
#修改su的權限為可執行文件
>adb shell >su root >cd /system/xbin/su >chmod 06755 su

#安裝些啥,照着做
>su --install

#打開守護進程
>su --daemon&

#Set SELinux to Permissive
>setenforce 0

 這里可重啟下模擬器在打開supersu會下載些文件,之后就可用了。到此,模擬器算是root了。

 

3.用XposedInstaller安裝xposed

  下載XposedInstaller_3.1.5.apk安裝,傻瓜式安裝即可。期間supersu會彈出對話框選擇同意,別錯過對話框。裝好后最好重啟下模擬器。

 

4.記得重新打開兼容

 

主要參考

 

1.MuMu模擬器怎么安裝Xposed框架

  有點過時,新版的mumu模擬器沒有root選項了,需要自己root,這也是我遇到的真正問題。

2.Rooting the Android Emulator – on Android Studio 2.3 (Android 4.4+)

       主要根據這個來,因為mumu模擬器可直接往/system/xbin目錄push文件,省略了一些步驟。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM