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 与模块文件一起从未捆绑的模块分支下载。
概括
公共方法 |
---|
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 |
公共构造函数
public BundletoolUtil (File bundletoolJar)
公共方法
从 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 :构建工件信息 |
生成设备规格文件
public String generateDeviceSpecFile (ITestDevice device)
为连接的设备配置生成 JSON 文件。
参数 |
---|
device | ITestDevice :连接的设备 |
安装Apks
public void installApks (File apks,
ITestDevice device,
extraArgs)
使用bundletool安装apk .apks。
参数 |
---|
apks | File :需要安装的apk |
device | ITestDevice :连接的设备 |
extraArgs | :用于bundletool命令。 |
安装Apks
public void installApks (File apks,
ITestDevice device)
使用bundletool安装apk .apks。
参数 |
---|
apks | File :需要安装的apk |
device | ITestDevice :连接的设备 |
从Zip安装Apks
public void installApksFromZip (File apksZip,
ITestDevice device,
extraArgs)
安装提供的 zip 文件中包含的 APK
参数 |
---|
apksZip | File :要安装的 zip 文件 |
device | ITestDevice :连接的设备 |
extraArgs | :传递给bundletool安装命令的附加参数 |
受保护的方法
获取AdbPath
protected String getAdbPath ()
protected File getBundletoolFile ()
解析命令超时
protected static long parseCmdTimeout ( args,
long defaultValue)