BundletoolUtil
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, List<String> extraArgs)
使用 bundletool 安裝 .apks 格式的 APK。 |
void
|
installApks(File apks, ITestDevice device)
使用 bundletool 安裝 .apks 格式的 APK。 |
void
|
installApksFromZip(File apksZip, ITestDevice device, List<String> extraArgs)
安裝所提供 ZIP 檔案中包含的 APK |
受保護的方法 | |
|---|---|
String
|
getAdbPath()
|
File
|
getBundletoolFile()
|
IRunUtil
|
getRunUtil()
|
static
long
|
parseCmdTimeout(List<String> args, long defaultValue)
|
公用建構函式
BundletoolUtil
public BundletoolUtil (File bundletoolJar)
| 參數 | |
|---|---|
bundletoolJar |
File |
公用方法
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:連結裝置 |
| 傳回 | |
|---|---|
String |
代表裝置規格檔案路徑的 String。 |
| 擲回 | |
|---|---|
IOException |
|
installApks
public void installApks (File apks,
ITestDevice device,
List<String> extraArgs)安裝使用 bundletool 的 apk .apks。
| 參數 | |
|---|---|
apks |
File:需要安裝的 APK |
device |
ITestDevice:連結裝置 |
extraArgs |
List:bundletool 指令。 |
| 擲回 | |
|---|---|
TargetSetupError |
|
installApks
public void installApks (File apks,
ITestDevice device)安裝使用 bundletool 的 apk .apks。
| 參數 | |
|---|---|
apks |
File:需要安裝的 APK |
device |
ITestDevice:連結裝置 |
| 擲回 | |
|---|---|
TargetSetupError |
|
installApksFromZip
public void installApksFromZip (File apksZip,
ITestDevice device,
List<String> extraArgs)安裝所提供 ZIP 檔案中的 APK
| 參數 | |
|---|---|
apksZip |
File:要安裝的 zip 檔案 |
device |
ITestDevice:連結裝置 |
extraArgs |
List:要傳遞至 bundletool 安裝指令的其他引數 |
| 擲回 | |
|---|---|
TargetSetupError |
|
受保護的方法
getAdbPath
protected String getAdbPath ()
| 傳回 | |
|---|---|
String |
|
getBundletoolFile
protected File getBundletoolFile ()
| 傳回 | |
|---|---|
File |
|
parseCmdTimeout
protected static long parseCmdTimeout (List<String> args,
long defaultValue)| 參數 | |
|---|---|
args |
List |
defaultValue |
long |
| 傳回 | |
|---|---|
long |
|
| 擲回 | |
|---|---|
TargetSetupError |
|