捆绑工具工具

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