Capture and upload images for application replay with the Android Image Capture tool

The Android Image Capture tool is used with the Android SDK and only runs in Android environments. It should be the primary tool you use to capture images in your application. However, if the Android Image Capture tool is unable to support your image replay experience, you can use the Target Simulator.

The Android Image Capture tool is a command-line program that automatically collects all the images in an Android application to an archive folder called images. The tool extracts and creates proper filepath mapping from your APK file, so the metadata collected from the Android client library for images can display properly.

Before you begin

Download and install the following:

  • The latest Android Tealeaf SDK eocore.jar and tealeafMod.jar libraries.
  • The teacuts.jar library for Auto Instrumentation, and check DisableAutoInstrumentation=false in the TealeafBasicConfig.properties file.
  • Build and run your Android project to generate an APK file.
  • Ruby version 2.4.2
  • Rake version 10.3.2
  • The zip and nokogiri gem modules.

Install the zip and nokogiri gem modules in a Mac OS environment

To install the zip and nokogiri gem modules in a Mac OS environment, follow these steps:

  1. Install Ruby version 2.4.2. For more information, see https://www.ruby-lang.org/en/documentation/installation/#homebrew.
  2. Open a terminal window.
  3. Enter xcode-select --install to install the Xcode Command Line tools.
  4. Enter gem install rubyzip '1.2.1' to install the rubyzip module.
  5. Enter gem install nokogiri '1.8.1' to install the nokogiri module.

Install the zip and nokogiri gem modules in a Windows environment

To install the zip and nokogiri gem modules in a Windows environment, follow these steps:

  1. Install Ruby version 2.4.2. For more information, see https://rubyinstaller.org/downloads/.
  2. Open a command prompt.
  3. Enter gem install rubyzip '1.2.1' to install the rubyzip module.
  4. Enter gem install nokogiri '1.8.1' to install the nokogiri module.

Collect the images

  1. Extract the AndroidImageCaptureTool file from the Android SDK package to your local path.
  2. Open a terminal or command line prompt.
    Change your directory to the folder where the Android Image Capture tool is located: cd <path to Android Image Capture Tool rake file>
  3. Use the following command and run the Android Image Capture tool with the rake file.
rake apk_file_path={YOUR/PROJECT/APK/PATH}
res_folder_path={YOUR/PROJECT/RES/PATH}

Example command:

rake apk_file_path=/Users/dancrisan/github/GitHub-Android-SDK/AndroidRelease/CXA/SampleCode/CXA-Android_auto/app/build/outputs/apk/app-debug.apk res_folder_path=/Users/dancrisan/github/GitHub-Android-SDK/AndroidRelease/CXA/SampleCode/CXA-Android_auto/app/src/main/res/
  1. The terminal will prompt: "Automatically find and update the layout xml files with attributes src, foreground, background? [Y/N]:" Type Y and press Enter.
  2. You are done collecting images. Your Android Image Capture tool now has a folder called "images." Next, the contents of this folder need to be added to the images folder on Replay.

Your terminal should like this:

Extract the vector xml files

📘

Note:

Only for applications containing vector xml files. If you do not have an application with vector xml files, skip to step 5.

Replay can not render .xml files, and they have to be extracted manually:

  1. Access the xml file within Android Studio and display the xml in Preview mode.
  2. Take a screenshot of image in Preview mode.
  3. Eliminate the background by using GIMP or any image editing software tool.
  4. Save the image without a background as a .png.
  5. Add the image to the images folder created in step 3.

Upload images to Replay

  1. Rename your images folder created in Step 3 to replayImages and zip this folder.
  2. On your Replay portal, go to the Organization tab and click on Manage Accounts.
  3. Click on the Company Settings tab.
  4. Scroll until you see Image package
  5. If a timestamp is present, click on the timestamp to download all the images folder from the organization.
  6. Unzip the downloaded folder.
  7. Add the contents of the image folder created in Step 3 (the pictures from the Android application).
  8. Zip it back up and name it imagesReplay.zip.
  9. On the portal, click on Edit at the bottom right corner of the page.
  10. Click on Change the file by the timestamp for the Image package
  11. Click Browse, select the imagesReplay.zip folder from your machine, and click Upload.
  12. Important: Wait until the timestamp changes. Only after the timestamp changes, click Save.
  13. Return to your session, your images should display now.

Your images should display on your Replay session.

Troubleshooting