捆綁工具工具

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, 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

受保護的方法

String getAdbPath ()
File getBundletoolFile ()
IRunUtil getRunUtil ()
static long parseCmdTimeout ( args, long defaultValue) parseCmdTimeout ( args, long defaultValue)

公共構造函數

捆綁工具工具

public BundletoolUtil (File bundletoolJar)

參數
bundletoolJar File

公共方法

從 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 :建置工件訊息

退貨
File ERROR(/File)是提取的 apk(s)/apex 所在的目錄

產生設備規格文件

public String generateDeviceSpecFile (ITestDevice device)

為連接的設備配置產生 JSON 檔案。

參數
device ITestDevice :連接的設備

退貨
String表示設備規範文件路徑的String

安裝Apks

public void installApks (File apks, 
                ITestDevice device, 
                 extraArgs)

使用bundletool安裝apk .apks。

參數
apks File :需要安裝的apk

device ITestDevice :連接的設備

extraArgs :用於bundletool指令。

投擲
TargetSetupError

安裝Apks

public void installApks (File apks, 
                ITestDevice device)

使用bundletool安裝apk .apks。

參數
apks File :需要安裝的apk

device ITestDevice :連接的設備

投擲
TargetSetupError

從Zip安裝Apks

public void installApksFromZip (File apksZip, 
                ITestDevice device, 
                 extraArgs)

安裝提供的 zip 檔案中包含的 APK

參數
apksZip File :要安裝的 zip 文件

device ITestDevice :連接的設備

extraArgs :傳遞給bundletool安裝指令的附加參數

投擲
TargetSetupError

受保護的方法

取得AdbPath

protected String getAdbPath ()

退貨
String

取得BundletoolFile

protected File getBundletoolFile ()

退貨
File

取得運行工具

protected IRunUtil getRunUtil ()

退貨
IRunUtil

解析命令逾時

protected static long parseCmdTimeout ( args, 
                long defaultValue)

參數
args

defaultValue long

退貨
long

投擲
TargetSetupError