android usb集线器,通过Maven将多个部署到USB集线器上的Android设备
當前版本的Android SDK不支持同時在多個連接的設備上安裝apk.這是一個硬性限制,因此目前唯一的解決方法是迭代連接的設備并為每個設備發出安裝命令.
如果你看一下android-maven-plugin documentation,你可以看到android中有一個有趣的參數:你可以在pom.xml中指定的部署目標:
device:
Specifies which device to connect to, by serial number. Special values “usb” and “emulator” are also valid, for selecting the only USB connected device or the only running emulator, respectively.
Type: java.lang.String
Required: No
Expression: ${android.device}
好吧,該文檔聲稱它將安裝apk到唯一連接的設備.我自己測試了它,如果連接了多個設備,它也可以工作.
示例pom.xml:
com.jayway.maven.plugins.android.generation2
android-maven-plugin
true
13
true
usb
通過運行mvn android:deploy來示例日志:
[INFO] Waiting for initial device list from the Android Debug Bridge
[INFO] Found 2 devices connected with the Android Debug Bridge
[INFO] android.device parameter set to usb
[INFO] Device 0123456789abcd_samsung_GT-I9100 found.
[INFO] Successfully uninstalled com.company.app from 0123456789abcd_samsung_GT-I9100
[INFO] Device 0123456789efg_HTC_HTCDesire found.
[INFO] Successfully uninstalled com.company.app from 0123456789efg_HTC_HTCDesire
[INFO] Found 2 devices connected with the Android Debug Bridge
[INFO] android.device parameter set to usb
[INFO] Device 0123456789abcd_samsung_GT-I9100 found.
[INFO] Successfully installed C:\workspace\my-app\target\app-1.0.0-SNAPSHOT.apk to 0123456789abcd_samsung_GT-I9100
[INFO] Device 0123456789efg_HTC_HTCDesire found.
[INFO] Successfully installed C:\workspace\my-app\target\app-1.0.0-SNAPSHOT.apk to 0123456789efg_HTC_HTCDesire
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
如果你想知道android-maven-plugin如何實現它,請查看source code here.
總結
以上是生活随笔為你收集整理的android usb集线器,通过Maven将多个部署到USB集线器上的Android设备的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 餐饮行业为什么要培训?
- 下一篇: 哪座城市的美食最多,最好吃?