BundletoolUtil

public class BundletoolUtil
extends Object

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


Utility class that uses bundletool command line to install the .apks on deivce. Bundletool doc link: https://developer.android.com/studio/command-line/bundletool The bundletool.jar is downloaded from the unbundled module branch together with the module file.

Summary

Public constructors

BundletoolUtil(File bundletoolJar)

Public methods

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

Extracts the split apk/apex from .apks.

String generateDeviceSpecFile(ITestDevice device)

Generates a JSON file for a connected device configuration.

File getBundletoolFile()
void installApks(File apks, ITestDevice device)

Installs the apk .apks that using bundletool.

Protected methods

String getAdbPath()
IRunUtil getRunUtil()

Public constructors

BundletoolUtil

public BundletoolUtil (File bundletoolJar)

Parameters
bundletoolJar File

Public methods

extractSplitsFromApks

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

Extracts the split apk/apex from .apks. Renames the splits and stores the splits to the directory where .apks stored. Returns the new directory that the splits stored.

Parameters
apks File: the apks that need to be extracted

deviceSpecPath String: the device spec file that bundletool uses to extract the apks

device ITestDevice: the connected device

buildInfo IBuildInfo: build artifact information

Returns
File a ERROR(/File) that is the directory where the extracted apk(s)/apex live under

generateDeviceSpecFile

public String generateDeviceSpecFile (ITestDevice device)

Generates a JSON file for a connected device configuration.

Parameters
device ITestDevice: the connected device

Returns
String a String representing the path of the device specification file.

getBundletoolFile

public File getBundletoolFile ()

Returns
File

installApks

public void installApks (File apks, 
                ITestDevice device)

Installs the apk .apks that using bundletool.

Parameters
apks File: the apks that need to be installed

device ITestDevice: the connected device

Throws
TargetSetupError

Protected methods

getAdbPath

protected String getAdbPath ()

Returns
String

getRunUtil

protected IRunUtil getRunUtil ()

Returns
IRunUtil