自 2026 年起,为了与我们的主干稳定开发模型保持一致,并确保生态系统的平台稳定性,我们将在第 2 季度和第 4 季度向 AOSP 发布源代码。如需构建 AOSP 并为其贡献代码,请使用 android-latest-release。android-latest-release 清单分支将始终引用推送到 AOSP 的最新版本。如需了解详情,请参阅 AOSP 变更。
Google uses AI technology to translate content into your preferred language. AI translations can contain errors.
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
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 是从非捆绑模块分支下载的,与模块文件一起下载。
摘要
公共构造函数
public BundletoolUtil (File bundletoolJar)
公共方法
extractSplitsFromApks
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 |
一个 File,即提取的 APK/APEX 所在的目录 |
generateDeviceSpecFile
public String generateDeviceSpecFile (ITestDevice device)
为已连接的设备配置生成 JSON 文件。
| 参数 |
device |
ITestDevice:已连接的设备 |
| 返回 |
String |
一个 String,表示设备规范文件的路径。 |
installApks
public void installApks (File apks,
ITestDevice device,
List<String> extraArgs)
安装使用 bundletool 的 APK .apks。
| 参数 |
apks |
File:需要安装的 APK |
device |
ITestDevice:已连接的设备 |
extraArgs |
List:用于 bundletool 命令。 |
installApks
public void installApks (File apks,
ITestDevice device)
安装使用 bundletool 的 APK .apks。
| 参数 |
apks |
File:需要安装的 APK |
device |
ITestDevice:已连接的设备 |
installApksFromZip
public void installApksFromZip (File apksZip,
ITestDevice device,
List<String> extraArgs)
安装所提供 zip 文件中包含的 APK
| 参数 |
apksZip |
File:要安装的 ZIP 文件 |
device |
ITestDevice:已连接的设备 |
extraArgs |
List:要传递给 bundletool install 命令的其他实参 |
受保护的方法
getAdbPath
protected String getAdbPath ()
protected File getBundletoolFile ()
getRunUtil
protected IRunUtil getRunUtil ()
parseCmdTimeout
protected static long parseCmdTimeout (List<String> args,
long defaultValue)
| 参数 |
args |
List |
defaultValue |
long |
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2026-06-22。
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["没有我需要的信息","missingTheInformationINeed","thumb-down"],["太复杂/步骤太多","tooComplicatedTooManySteps","thumb-down"],["内容需要更新","outOfDate","thumb-down"],["翻译问题","translationIssue","thumb-down"],["示例/代码问题","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2026-06-22。"],[],[]]