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 從未套件的模組分支下載 bundletool.jar 和模組檔案。
摘要
公用建構函式 | |
---|---|
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。 |
void
|
installApks(File apks, ITestDevice device)
安裝使用 bundletool 的 APK .apk。 |
void
|
installApksFromZip(File apksZip, ITestDevice device,
安裝提供的 ZIP 檔案中所含 APK |
受保護的方法 | |
---|---|
String
|
getAdbPath()
|
File
|
getBundletoolFile()
|
IRunUtil
|
getRunUtil()
|
static
long
|
parseCmdTimeout(
|
公用建構函式
BundletoolUtil
public BundletoolUtil (File bundletoolJar)
參數 | |
---|---|
bundletoolJar |
File |
公用方法
extractSplitsFromApks
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 :建構構件資訊 |
傳回 | |
---|---|
File |
ERROR(/File) :是擷取的 APK/apex 所在的目錄 |
generateDeviceSpecFile
public String generateDeviceSpecFile (ITestDevice device)
為已連結的裝置設定產生 JSON 檔案。
參數 | |
---|---|
device |
ITestDevice :已連結的裝置 |
傳回 | |
---|---|
String |
String :代表裝置規格檔案的路徑。 |
installApks
public void installApks (File apks, ITestDevice device,extraArgs)
安裝使用 bundletool 產生的 APK .apk。
參數 | |
---|---|
apks |
File :需要安裝的 APK |
device |
ITestDevice :已連結的裝置 |
extraArgs |
:適用於 bundletool 指令。 |
擲回 | |
---|---|
TargetSetupError |
installApks
public void installApks (File apks, ITestDevice device)
安裝使用 bundletool 產生的 APK .apk。
參數 | |
---|---|
apks |
File :需要安裝的 APK |
device |
ITestDevice :已連結的裝置 |
擲回 | |
---|---|
TargetSetupError |
installApksFromZip
public void installApksFromZip (File apksZip, ITestDevice device,extraArgs)
安裝提供的 ZIP 檔案中所含 APK
參數 | |
---|---|
apksZip |
File :要安裝的 ZIP 檔案 |
device |
ITestDevice :已連結的裝置 |
extraArgs |
:要傳遞至 bundletool 安裝指令的其他引數 |
擲回 | |
---|---|
TargetSetupError |
受保護的方法
getAdbPath
protected String getAdbPath ()
傳回 | |
---|---|
String |
getBundletoolFile
protected File getBundletoolFile ()
傳回 | |
---|---|
File |
parseCmdTimeout
protected static long parseCmdTimeout (args, long defaultValue)
參數 | |
---|---|
args |
|
defaultValue |
long |
傳回 | |
---|---|
long |
擲回 | |
---|---|
TargetSetupError |