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。

受保護的方法

String getAdbPath()
File getBundletoolFile()
IRunUtil getRunUtil()

公用建構函式

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)

安裝使用 bundletool 產生的 APK .apk。

參數
apks File:需要安裝的 APK

device ITestDevice:已連結的裝置

擲回
TargetSetupError

受保護的方法

getAdbPath

protected String getAdbPath ()

傳回
String

getBundletoolFile

protected File getBundletoolFile ()

傳回
File

getRunUtil

protected IRunUtil getRunUtil ()

傳回
IRunUtil