android adb自动连接手机安装apk bat

1.新建bat文件adb

@echo off

:apk文件名称 在setting.txt获取
set apkFileName=""

:设置文件
set settingFile=E:\apk\bat\setting.txt

:启动页面 applicationid/启动页面路径
set startActivity=com.aaa.aaa/com.aaa.aaa.ui.common.SplashActivity

:读取settingFile第一行的zikao值
for /f "skip=1 tokens=3" %%a in (%settingFile%) do (
    set apkFileName=%%a
    goto :Show
)
:Show

echo if install  %apkFileName% ?
pause

:读取读取settingFile第二行以下值,下面是ip
for /f "skip=2" %%i in (%settingFile%) do (
    echo -----------------------start----------------------------
   adb connect %%i
   adb -s %%i install -r  %apkFileName%
   adb -s %%i shell am start -n %startActivity%
   echo -----------------------end----------------------------
)
pause

2.新建setting.txt

aaa = E:\apk\sign.apk
192.168.11.11

aaa:待安装的apk名称路径

192.168.11.11待安装的手机ip(androidstudio 推荐通过ADB Wi-Fi插件先连接上手机 ,查看ip)

不足:

有时候adb安装会卡住,点击回车键即可,怎么多线程安装暂时不懂

你可能感兴趣的:(android,adb)