之前电脑系统升级了win11,顺道也安装上了安卓子系统

然后一直放那嫌弃占用内存也没用过

今天准备在安卓子系统安装一个米家app方便查看监控

安装apk就只需要执行命令adb install

首先在小米应用商店下载apk文件

然后启动子系统,直接打开安卓子系统的文件应用就可以了

这时候直接执adb install *.apk就报错了

PS C:\Users\wixy> cd D:\MyPrograms\adb
PS D:\MyPrograms\adb> adb install "C:\Users\wixy\Downloads\com.xiaomi.smarthome.apk"
* daemon not running; starting now at tcp:5037
* daemon started successfully
Performing Push Install
adb: error: failed to get feature set: device still authorizing

想起来没有connect,此时需要执行adb connect ip:port

PS D:\MyPrograms\adb> adb connect 127.0.0.1:58526
connected to 127.0.0.1:58526

在安卓子系统的开发人员选项中可以看到ip和端口

然后迫不及待的再install,果不其然又报错了

PS D:\MyPrograms\adb> adb install "C:\Users\wixy\Downloads\com.xiaomi.smarthome.apk"
Performing Push Install
adb: error: failed to get feature set: more than one device/emulator

此时提示现在连接的不止一个设备或者模拟器,我们可以执行adb devices查看我们连接的设备

PS D:\MyPrograms\adb> adb devices
List of devices attached
127.0.0.1:58526 device
emulator-5554   device

最后我们指定设备安装apk就行了

PS D:\MyPrograms\adb> adb -s 127.0.0.1:58526 install "C:\Users\wixy\Downloads\com.xiaomi.smarthome.apk"
Performing Streamed Install
Success

搞定收工(又成功水了一篇文章