Starting March 27, 2025, we recommend using android-latest-release instead of aosp-main to build and contribute to AOSP. For more information, see Changes to AOSP.
         
       
     
  
  
  
  
  
    
    
      
    
    
      
      Stay organized with collections
    
    
      
      Save and categorize content based on your preferences.
    
  
  
    
  
  
  
  
    
  
  
    
    
  
  
  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
    
    
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 Stringrepresenting the path of the device specification file. | 
    
 
    installApks
    
public void installApks (File apks, 
                ITestDevice device, 
                 extraArgs)
    
    
    
  Installs the apk .apks that using bundletool.
    
    | Parameters | 
|---|
      
        | apks | File: the apks that need to be installed | 
      
        | device | ITestDevice: the connected device | 
      
        | extraArgs | : for the bundletool command. | 
    
      
  
 
    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 | 
    
      
  
 
    installApksFromZip
    
public void installApksFromZip (File apksZip, 
                ITestDevice device, 
                 extraArgs)
    
    
    
  Installs the apks contained in provided zip file
    
    | Parameters | 
|---|
      
        | apksZip | File: the zip file to install | 
      
        | device | ITestDevice: the connected device | 
      
        | extraArgs | : additional args to pass to bundletool install command | 
    
      
  
 
Protected methods
    getAdbPath
    
protected String getAdbPath ()
    
    
    
  
    
 
    
    
protected File getBundletoolFile ()
    
    
    
  
    
 
    getRunUtil
    
protected IRunUtil getRunUtil ()
    
    
    
  
    
 
    parseCmdTimeout
    
protected static long parseCmdTimeout ( args, 
                long defaultValue)
    
    
    
  
    
    | Parameters | 
|---|
      
        | args |  | 
      
        | defaultValue | long | 
    
    
      
  
 
 
 
  
  
 
  
    
    
      
    
    
  
       
    
    
  
  
  Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
  Last updated 2023-07-19 UTC.
  
  
  
    
      [[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2023-07-19 UTC."],[],[]]