BundletoolUtil

public class BundletoolUtil
extends Object

java.lang.Object
com.android.tradefed.util.BundletoolUtil


Lớp tiện ích sử dụng dòng lệnh bundletool để cài đặt .apks trên thiết bị. Đường liên kết đến tài liệu về bundletool: https://developer.android.com/studio/command-line/bundletool bundletool.jar được tải xuống từ nhánh mô-đun không được gói cùng với tệp mô-đun.

Tóm tắt

Hàm khởi tạo công khai

BundletoolUtil(File bundletoolJar)

Phương thức công khai

File extractSplitsFromApks(File apks, String deviceSpecPath, ITestDevice device, IBuildInfo buildInfo)

Trích xuất apk/apex phân tách từ .apks.

String generateDeviceSpecFile(ITestDevice device)

Tạo tệp JSON cho cấu hình thiết bị thông minh.

void installApks(File apks, ITestDevice device, List<String> extraArgs)

Cài đặt apk .apks bằng bundletool.

void installApks(File apks, ITestDevice device)

Cài đặt apk .apks bằng bundletool.

void installApksFromZip(File apksZip, ITestDevice device, List<String> extraArgs)

Cài đặt các apk có trong tệp zip được cung cấp

Phương thức được bảo vệ

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

Hàm khởi tạo công khai

BundletoolUtil

public BundletoolUtil (File bundletoolJar)

Tham số
bundletoolJar File

Phương thức công khai

extractSplitsFromApks

public File extractSplitsFromApks (File apks, 
                String deviceSpecPath, 
                ITestDevice device, 
                IBuildInfo buildInfo)

Trích xuất apk/apex phân tách từ .apks. Đổi tên các phần tách và lưu trữ các phần tách vào thư mục lưu trữ .apks. Trả về thư mục mới lưu trữ các phần tách.

Tham số
apks File: các apk cần trích xuất

deviceSpecPath String: tệp đặc tả thiết bị mà bundletool dùng để trích xuất các apk

device ITestDevice: thiết bị thông minh

buildInfo IBuildInfo: thông tin về cấu phần phần mềm bản dựng

Giá trị trả về
File File là thư mục lưu trữ các apk/apex đã trích xuất

generateDeviceSpecFile

public String generateDeviceSpecFile (ITestDevice device)

Tạo tệp JSON cho cấu hình thiết bị thông minh.

Tham số
device ITestDevice: thiết bị thông minh

Giá trị trả về
String String đại diện cho đường dẫn của tệp đặc tả thiết bị.

Gửi
IOException

installApks

public void installApks (File apks, 
                ITestDevice device, 
                List<String> extraArgs)

Cài đặt apk .apks bằng bundletool.

Tham số
apks File: các apk cần cài đặt

device ITestDevice: thiết bị thông minh

extraArgs List: cho lệnh bundletool.

Gửi
TargetSetupError

installApks

public void installApks (File apks, 
                ITestDevice device)

Cài đặt apk .apks bằng bundletool.

Tham số
apks File: các apk cần cài đặt

device ITestDevice: thiết bị thông minh

Gửi
TargetSetupError

installApksFromZip

public void installApksFromZip (File apksZip, 
                ITestDevice device, 
                List<String> extraArgs)

Cài đặt các apk có trong tệp zip được cung cấp

Tham số
apksZip File: tệp zip cần cài đặt

device ITestDevice: thiết bị thông minh

extraArgs List: các đối số bổ sung để chuyển đến lệnh cài đặt bundletool

Gửi
TargetSetupError

Phương thức được bảo vệ

getAdbPath

protected String getAdbPath ()

Giá trị trả về
String

getBundletoolFile

protected File getBundletoolFile ()

Giá trị trả về
File

getRunUtil

protected IRunUtil getRunUtil ()

Giá trị trả về
IRunUtil

parseCmdTimeout

protected static long parseCmdTimeout (List<String> args, 
                long defaultValue)

Tham số
args List

defaultValue long

Giá trị trả về
long

Gửi
TargetSetupError