通过adb把apk安装到系统分区

通过adb把apk安装到系统分区

以谷歌拼音为例:
GooglePinyin1.4.2.apk
提取出so文件
libjni_googlepinyinime_4.so
libjni_googlepinyinime_latinime_4.so


bat批处理脚本内容如下:
path "D:\Program Files\完美刷机\tools";%path%


prompt $G
cd /d "%1"
cls


adb devices


adb shell su -c "mount -o remount rw /system"


set APK=GooglePinyin1.4.2.apk
adb push %APK% /data/local/tmp/
adb shell su -c "cat /data/local/tmp/%APK% > /system/app/%APK%"
adb shell su -c "chown 0.0 /system/app/%APK%"
adb shell su -c "chmod 644 /system/app/%APK%"


set LIB=libjni_googlepinyinime_4.so
adb push %LIB% /data/local/tmp/
adb shell su -c "cat /data/local/tmp/%LIB% > /system/lib/%LIB%"
adb shell su -c "chown 0.0 /system/lib/%LIB%"
adb shell su -c "chmod 644 /system/lib/%LIB%"


set LIB=libjni_googlepinyinime_latinime_4.so
adb push %LIB% /data/local/tmp/
adb shell su -c "cat /data/local/tmp/%LIB% > /system/lib/%LIB%"
adb shell su -c "chown 0.0 /system/lib/%LIB%"
adb shell su -c "chmod 644 /system/lib/%LIB%"


adb shell su -c "mount -o remount rw /system"
pause


adb reboot


如果apk软件特别多的话,需要用批量安装脚本,内容如下
path "D:\Program Files\完美刷机\tools";%path%


prompt $G
cd /d "%1"
cls
@echo 当前目录:cd  =%cd%
@echo 当前文件:file=%file%
@echo.
adb wait-for-device
adb devices


adb shell su -c "mount -o remount rw /system"


for /f "delims=" %%i in ('dir /b /a-d /s *.apk') do (
echo push %%~nxi to /system/app
set APK=%%~nxi
adb push %%~nxi /data/local/tmp/
adb shell su -c "cat /data/local/tmp/%%~nxi > /system/app/%%~nxi"
adb shell su -c "chown 0.0 /system/app/%%~nxi"
adb shell su -c "chmod 644 /system/app/%%~nxi"
adb shell su -c "rm /data/local/tmp/%%~nxi"
)


for /f "delims=" %%j in ('dir /b /a-d /s *.so') do (
echo push %%~nxj to /system/lib
set LIB=%%~nxj
adb push %%~nxj /data/local/tmp/
adb shell su -c "cat /data/local/tmp/%%~nxj > /system/lib/%%~nxj"
adb shell su -c "chown 0.0 /system/lib/%%~nxj"
adb shell su -c "chmod 644 /system/lib/%%~nxj"
adb shell su -c "rm /data/local/tmp/%%~nxj"
)


adb shell su -c "mount -o remount rw /system"


pause
adb reboot


这个脚本还支持,把apk文件夹拖动到上面自动安装。

你可能感兴趣的:(adb)