BundletoolUtil

public class BundletoolUtil
extends Object

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


该实用程序类使用 bundletool 命令行在设备上安装 .apk。bundletool 文档 链接:https://developer.android.com/studio/command-line/bundletool 随模块文件一起从未捆绑模块分支下载。

摘要

公共构造函数

BundletoolUtil(File bundletoolJar)

公共方法

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

从 .apk 中提取拆分的 apk/apex。

String generateDeviceSpecFile(ITestDevice device)

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

void installApks(File apks, ITestDevice device)

安装使用 bundletool 的 apk .apk。

受保护的方法

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

公共构造函数

BundletoolUtil

public BundletoolUtil (File bundletoolJar)

参数
bundletoolJar File

公共方法

从 APK 提取拆分

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

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

参数
apks File:需要解压缩的 APK

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

device ITestDevice:已连接的设备

buildInfo IBuildInfo:build 工件信息

返回
File ERROR(/File),即提取的 apk/apex 所在的目录

generateDeviceSpecFile

public String generateDeviceSpecFile (ITestDevice device)

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

参数
device ITestDevice:已连接的设备

返回
String 表示设备规范文件的路径的 String

安装 APK

public void installApks (File apks, 
                ITestDevice device)

安装使用 bundletool 的 apk .apk。

参数
apks File:需要安装的 APK

device ITestDevice:已连接的设备

抛出
TargetSetupError

受保护的方法

getAdbPath

protected String getAdbPath ()

返回
String

getBundletoolFile

protected File getBundletoolFile ()

返回
File

getRunUtil

protected IRunUtil getRunUtil ()

返回
IRunUtil