捆綁工具工具

public class BundletoolUtil
extends Object

java.lang.Object
com.android.tradefed.util.BundletoolUtil


使用 bundletool 命令行在設備上安裝 .apks 的實用程序類。 Bundletool 文檔鏈接:https://developer.android.com/studio/command-line/bundletool bundletool.jar 與模塊文件一起從未捆綁的模塊分支下載。

概括

公共構造函數

BundletoolUtil (File bundletoolJar)

公共方法

File extractSplitsFromApks (File apks, String deviceSpecPath, ITestDevice device, IBuildInfo buildInfo)

從 .apks 中提取拆分的 apk/apex。

String generateDeviceSpecFile ( ITestDevice device)

為連接的設備配置生成一個 JSON 文件。

void installApks (File apks, ITestDevice device)

安裝使用 bundletool 的 apk .apks。

void installApksFromZip (File apksZip, ITestDevice device, extraArgs) installApksFromZip (File apksZip, ITestDevice device, extraArgs)

安裝提供的 zip 文件中包含的 apk

受保護的方法

String getAdbPath ()
File getBundletoolFile ()
IRunUtil getRunUtil ()

公共構造函數

捆綁工具工具

public BundletoolUtil (File bundletoolJar)

參數
bundletoolJar File

公共方法

提取SplitsFromApks

public File extractSplitsFromApks (File apks, 
                String deviceSpecPath, 
                ITestDevice device, 
                IBuildInfo buildInfo)

從 .apks 中提取拆分的 apk/apex。重命名拆分並將拆分存儲到 .apks 存儲的目錄。返回拆分存儲的新目錄。

參數
apks File : 需要提取的apks

deviceSpecPath String :bundletool 用於提取 apk 的設備規範文件

device ITestDevice : 連接的設備

buildInfo IBuildInfo :構建工件信息

退貨
File一個ERROR(/File)是提取的 apk(s)/apex 所在的目錄

生成設備規格文件

public String generateDeviceSpecFile (ITestDevice device)

為連接的設備配置生成一個 JSON 文件。

參數
device ITestDevice : 連接的設備

退貨
String表示設備規範文件路徑的ERROR(/String)

安裝Apks

public void installApks (File apks, 
                ITestDevice device)

安裝使用 bundletool 的 apk .apks。

參數
apks File : 需要安裝的apks

device ITestDevice : 連接的設備

投擲
TargetSetupError

安裝ApksFromZip

public void installApksFromZip (File apksZip, 
                ITestDevice device, 
                 extraArgs)

安裝提供的 zip 文件中包含的 apk

參數
apksZip File :要安裝的 zip 文件

device ITestDevice : 連接的設備

extraArgs :傳遞給 bundletool 安裝命令的附加參數

投擲
TargetSetupError

受保護的方法

獲取 AdbPath

protected String getAdbPath ()

退貨
String

獲取捆綁工具文件

protected File getBundletoolFile ()

退貨
File

getRunUtil

protected IRunUtil getRunUtil ()

退貨
IRunUtil