為配合主幹穩定開發模型,並確保生態系統的平台穩定性,我們將自 2026 年起,在第 2 季和第 4 季將原始碼發布至 AOSP。如要建構及貢獻 AOSP,請使用 android-latest-release。android-latest-release 資訊清單分支版本一律會參照推送至 Android 開放原始碼計畫的最新版本。詳情請參閱「Android 開放原始碼計畫變更」。
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。重新命名分割檔,並將分割檔儲存至儲存 .apk 的目錄。傳回儲存分割的新目錄。
| 參數 |
apks |
File:需要解壓縮的 APK |
deviceSpecPath |
String:bundletool 用於擷取 APK 的裝置規格檔案 |
device |
ITestDevice:連結裝置 |
buildInfo |
IBuildInfo:建構構件資訊 |
| 傳回 |
File |
File:這是解壓縮 APK/APEX 檔案的目錄 |
generateDeviceSpecFile
public String generateDeviceSpecFile (ITestDevice device)
為連結裝置設定產生 JSON 檔案。
| 參數 |
device |
ITestDevice:連結裝置 |
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 安裝指令的其他引數 |
受保護的方法
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 和/或其關係企業的商標或註冊商標。
上次更新時間: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"]],["上次更新時間:2026-06-22 (世界標準時間)。"],[],[]]