捆绑工具工具

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, extraArgs) installApks (File apks, ITestDevice device, extraArgs)

使用bundletool安装apk .apks。

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 ()
static long parseCmdTimeout ( args, long defaultValue) parseCmdTimeout ( args, long defaultValue)

公共构造函数

捆绑工具工具

public BundletoolUtil (File bundletoolJar)

参数
bundletoolJar File

公共方法

从 Apks 中提取拆分

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

从 .apks 中提取拆分的 apk/apex。重命名拆分并将拆分存储到 .apks 存储的目录。返回分割存储的新目录。

参数
apks File :需要解压的apk

deviceSpecPath String :bundletool 用于提取 apk 的设备规格文件

device ITestDevice :连接的设备

buildInfo IBuildInfo :构建工件信息

退货
File ERROR(/File)是提取的 apk(s)/apex 所在的目录

生成设备规格文件

public String generateDeviceSpecFile (ITestDevice device)

为连接的设备配置生成 JSON 文件。

参数
device ITestDevice :连接的设备

退货
String表示设备规范文件路径的String

安装Apks

public void installApks (File apks, 
                ITestDevice device, 
                 extraArgs)

使用bundletool安装apk .apks。

参数
apks File :需要安装的apk

device ITestDevice :连接的设备

extraArgs :用于bundletool命令。

投掷
TargetSetupError

安装Apks

public void installApks (File apks, 
                ITestDevice device)

使用bundletool安装apk .apks。

参数
apks File :需要安装的apk

device ITestDevice :连接的设备

投掷
TargetSetupError

从Zip安装Apks

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

安装提供的 zip 文件中包含的 APK

参数
apksZip File :要安装的 zip 文件

device ITestDevice :连接的设备

extraArgs :传递给bundletool安装命令的附加参数

投掷
TargetSetupError

受保护的方法

获取AdbPath

protected String getAdbPath ()

退货
String

获取BundletoolFile

protected File getBundletoolFile ()

退货
File

获取运行工具

protected IRunUtil getRunUtil ()

退货
IRunUtil

解析命令超时

protected static long parseCmdTimeout ( args, 
                long defaultValue)

参数
args

defaultValue long

退货
long

投掷
TargetSetupError