Android笔记-雷电模拟器(Android5.1.1)安装Xposed
生活随笔
收集整理的這篇文章主要介紹了
Android笔记-雷电模拟器(Android5.1.1)安装Xposed
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
首先安裝Xposed Installer。發現這臺機器是API 22,并且CPU為x86的。
進入這個
https://dl-xda.xposed.info/framework/sdk22/x86/
其他的sdk也有,選擇對應的就可以了。選擇zip的。
安裝此SDK的最新版。
新建xposed文件夾,將zip解壓,將system放到xposed文件夾中
在xposed中新建script.sh
?內容如下:
########################################################################################## # # Xposed framework installer zip. # # This script installs the Xposed framework files to the system partition. # The Xposed Installer app is needed as well to manage the installed modules. # ##########################################################################################grep_prop() {REGEX="s/^$1=//p"shiftFILES=$@if [ -z "$FILES" ]; thenFILES='/system/build.prop'ficat $FILES 2>/dev/null | sed -n $REGEX | head -n 1 }android_version() {case $1 in15) echo '4.0 / SDK'$1;;16) echo '4.1 / SDK'$1;;17) echo '4.2 / SDK'$1;;18) echo '4.3 / SDK'$1;;19) echo '4.4 / SDK'$1;;21) echo '5.0 / SDK'$1;;22) echo '5.1 / SDK'$1;;23) echo '6.0 / SDK'$1;;24) echo '7.0 / SDK'$1;;25) echo '7.1 / SDK'$1;;26) echo '8.0 / SDK'$1;;27) echo '8.1 / SDK'$1;;*) echo 'SDK'$1;;esac }cp_perm() {cp -f $1 $2 || exit 1set_perm $2 $3 $4 $5 $6 }set_perm() {chown $2:$3 $1 || exit 1chmod $4 $1 || exit 1if [ "$5" ]; thenchcon $5 $1 2>/dev/nullelsechcon 'u:object_r:system_file:s0' $1 2>/dev/nullfi }install_nobackup() {cp_perm ./$1 $1 $2 $3 $4 $5 }install_and_link() {TARGET=$1XPOSED="${1}_xposed"BACKUP="${1}_original"if [ ! -f ./$XPOSED ]; thenreturnficp_perm ./$XPOSED $XPOSED $2 $3 $4 $5if [ ! -f $BACKUP ]; thenmv $TARGET $BACKUP || exit 1ln -s $XPOSED $TARGET || exit 1chcon -h 'u:object_r:system_file:s0' $TARGET 2>/dev/nullfi }install_overwrite() {TARGET=$1if [ ! -f ./$TARGET ]; thenreturnfiBACKUP="${1}.orig"NO_ORIG="${1}.no_orig"if [ ! -f $TARGET ]; thentouch $NO_ORIG || exit 1set_perm $NO_ORIG 0 0 600elif [ -f $BACKUP ]; thenrm -f $TARGETgzip $BACKUP || exit 1set_perm "${BACKUP}.gz" 0 0 600elif [ ! -f "${BACKUP}.gz" -a ! -f $NO_ORIG ]; thenmv $TARGET $BACKUP || exit 1gzip $BACKUP || exit 1set_perm "${BACKUP}.gz" 0 0 600ficp_perm ./$TARGET $TARGET $2 $3 $4 $5 }##########################################################################################echo "**************************" echo "Xposed framework installer" echo "**************************"if [ ! -f "system/xposed.prop" ]; thenecho "! Failed: Extracted file system/xposed.prop not found!"exit 1 fiecho "- Checking environment" API=$(grep_prop ro.build.version.sdk) APINAME=$(android_version $API) ABI=$(grep_prop ro.product.cpu.abi | cut -c-3) ABI2=$(grep_prop ro.product.cpu.abi2 | cut -c-3) ABILONG=$(grep_prop ro.product.cpu.abi)XVERSION=$(grep_prop version system/xposed.prop) XARCH=$(grep_prop arch system/xposed.prop) XMINSDK=$(grep_prop minsdk system/xposed.prop) XMAXSDK=$(grep_prop maxsdk system/xposed.prop)XEXPECTEDSDK=$(android_version $XMINSDK) if [ "$XMINSDK" != "$XMAXSDK" ]; thenXEXPECTEDSDK=$XEXPECTEDSDK' - '$(android_version $XMAXSDK) fiARCH=arm IS64BIT= if [ "$ABI" = "x86" ]; then ARCH=x86; fi; if [ "$ABI2" = "x86" ]; then ARCH=x86; fi; if [ "$API" -ge "21" ]; thenif [ "$ABILONG" = "arm64-v8a" ]; then ARCH=arm64; IS64BIT=1; fi;if [ "$ABILONG" = "x86_64" ]; then ARCH=x86_64; IS64BIT=1; fi; fi# echo "DBG [$API] [$ABI] [$ABI2] [$ABILONG] [$ARCH] [$XARCH] [$XMINSDK] [$XMAXSDK] [$XVERSION]"echo " Xposed version: $XVERSION"XVALID= if [ "$ARCH" = "$XARCH" ]; thenif [ "$API" -ge "$XMINSDK" ]; thenif [ "$API" -le "$XMAXSDK" ]; thenXVALID=1elseecho "! Wrong Android version: $APINAME"echo "! This file is for: $XEXPECTEDSDK"fielseecho "! Wrong Android version: $APINAME"echo "! This file is for: $XEXPECTEDSDK"fi elseecho "! Wrong platform: $ARCH"echo "! This file is for: $XARCH" fiif [ -z $XVALID ]; thenecho "! Please download the correct package"echo "! for your platform/ROM!"exit 1 fiecho "- Placing files" install_nobackup /system/xposed.prop 0 0 0644 install_nobackup /system/framework/XposedBridge.jar 0 0 0644install_and_link /system/bin/app_process32 0 2000 0755 u:object_r:zygote_exec:s0 install_overwrite /system/bin/dex2oat 0 2000 0755 u:object_r:dex2oat_exec:s0 install_overwrite /system/bin/oatdump 0 2000 0755 install_overwrite /system/bin/patchoat 0 2000 0755 u:object_r:dex2oat_exec:s0 install_overwrite /system/lib/libart.so 0 0 0644 install_overwrite /system/lib/libart-compiler.so 0 0 0644 install_overwrite /system/lib/libsigchain.so 0 0 0644 install_nobackup /system/lib/libxposed_art.so 0 0 0644 if [ $IS64BIT ]; theninstall_and_link /system/bin/app_process64 0 2000 0755 u:object_r:zygote_exec:s0install_overwrite /system/lib64/libart.so 0 0 0644install_overwrite /system/lib64/libart-compiler.so 0 0 0644install_overwrite /system/lib64/libart-disassembler.so 0 0 0644install_overwrite /system/lib64/libsigchain.so 0 0 0644install_nobackup /system/lib64/libxposed_art.so 0 0 0644 fimkdir -p /system/priv-app/XposedInstaller chmod 0755 /system/priv-app/XposedInstaller chcon -h u:object_r:system_file:s0 /system/priv-app/XposedInstaller cp system/priv-app/XposedInstaller/XposedInstaller.apk /system/priv-app/XposedInstaller/XposedInstaller.apk chmod 0644 /system/priv-app/XposedInstaller/XposedInstaller.apk chcon -h u:object_r:system_file:s0 /system/priv-app/XposedInstaller/XposedInstaller.apkif [ "$API" -ge "22" ]; thenfind /system /vendor -type f -name '*.odex.gz' 2>/dev/null | while read f; do mv "$f" "$f.xposed"; done fiecho "- Done" exit 0?隨后cmd
adb remount adb push D:\apkHack\xposed\xposed /system adb shellcd system mount -o remount -w /system sh script.sh我這里提示是這樣的:
?
然后重啟虛擬機,就可以了。
adb remount:重新掛載system分區,實現對system分區重新掛載。該命令主要是因為android系統的system分區在啟動之后是只讀分區,但在開發過程中需要對system分區進行修改,則需重新掛載成讀寫模式。
mount -o remount -w /system:以只讀的方法加載/system分區,意思就是把system重新設置為只讀。
總結
以上是生活随笔為你收集整理的Android笔记-雷电模拟器(Android5.1.1)安装Xposed的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: canvas笔记-画一片星空
- 下一篇: 信息安全工程师笔记-大数据安全威胁与需求