ADB指令之将apk安装到仿真器或真机

时间:2022-11-29 09:30:59

一、先启动好仿真器或真机

若是安装到真机先将开发者选项打开,同时要将里面的USB调试打开

ADB指令之将apk安装到仿真器或真机

二、使用adb install apk详细地址(直接将apk拖到cmd文本框中即可获取到)进行安装

 ADB指令之将apk安装到仿真器或真机

当出现Success表示安装成功

若仿真器或手机里面已存在要安装的程序,或者安装的程序没有卸载完全,如有数据残留,则可能出现以下异常提示

ADB指令之将apk安装到仿真器或真机

若出现上图情况,请执行以下命令

ADB指令之将apk安装到仿真器或真机

三、adb install 参数说明

adb install [-l] [-r] [-d] [-s] [--algo <algorithm name> --key <hex-encoded key> --iv <hex-encoded iv>] <file> - push this package file to the device and install it
('-l' means forward-lock the app)
('-r' means reinstall the app, keeping its data)
('-d' means allow version code downgrade)
('-s' means install on SD card instead of internal storage)
('--algo', '--key', and '--iv' mean the file is encrypted already)