install_apk 小鱼儿 2022-05-29 06:43 197阅读 0赞 如何安装apk并检查是否安装成功: 需求: 方法1:通过 push的方式安装 命令如下: adb root adb disable-verity adb reboot adb root adb remount adb shell cd /system/app mkdir SpeechController(创建一个文件夹) eixt adb push "D:\APK\speech apk\SpeechController.apk" /system/app/SpeechController adb shell sync reboot adb shell su ps |grep sp(查看语音板APK进程是否存在) 改写成bat脚本,步骤如下: (1)新建一个文本文档,假如叫: adb\_start\_env.txt (2)将(1)新建的文档后缀修改为.bat adb\_start\_env.bat (3)将以下内容复制到adb\_start.env.bat中,保存后退出。 @echo off ::所有以两个冒号::开始的行都是注释 ::code by rob.liu @xxx compony ::::::::第一步,disable-verity并重启 adb root ::adb disable-verity adb reboot ::pause ::::::::第二步,安装apk并重启 :::::::::::::::::::::::::::::::::::::::::::::以下代码用来检查设备是否重启成功 :startpoint ping 123.45.67.89 -n 1 -w 5000 > nul adb root adb remount If %errorlevel% EQU 0 ( echo device start success... echo adb remount success ... ) Else ( echo device not start yet......try again......please wait!!! goto startpoint ) :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ::如果设备已经开机成功,则开始安装apk adb shell mkdir -p /system/app/SpeechController adb push D:\APK\libmsc.so /system/lib64 adb push D:\APK\libledclient.so /system/lib64 adb push "D:\APK\speech apk\SpeechController.apk" /system/app/SpeechController adb shell sync adb reboot ::pause ::::::::第三步,通过获取pid检查是否安装成功 :::::::::::::::::::::::::::::::::::::::::::::以下代码用来检查设备是否重启成功 :startpoint_2 ping 123.45.67.89 -n 1 -w 5000 > nul adb root adb remount If %errorlevel% EQU 0 ( echo device start success...... echo adb remount success...... ) Else ( echo device not start yet......try again......please wait!!! goto startpoint_2 ) ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ::如果设备已经开机成功,则通过获取apk pid来判断设备是否安装成功:"ps | grep 进程名字" for /f "tokens=2 delims= " %%i in ('adb shell "ps | grep sp"') do ( echo get sp pid : %%i set PID=%%i ) echo %PID% IF %PID% GTR 0 ( echo we get sp pid: %PID% echo ______result______: sp install success...... ) ELSE ( echo failed, please try again! echo ______result______: sp install failed...... ) pause & exit (4)双击adb\_start.env.bat执行 附件也上传一份吧,需要的可以直接下载,需要积分下载,无法设成免费: https://download.csdn.net/download/stn\_lcd/10295911
还没有评论,来说两句吧...