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
andtealeafMod.jar
libraries. - The
teacuts.jar
library for Auto Instrumentation, and checkDisableAutoInstrumentation=false
in theTealeafBasicConfig.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
andnokogiri
gem modules.
Install the zip
and nokogiri
gem modules in a Mac OS environment
zip
and nokogiri
gem modules in a Mac OS environmentTo install the zip
and nokogiri
gem modules in a Mac OS environment, follow these steps:
- Install Ruby version 2.4.2. For more information, see https://www.ruby-lang.org/en/documentation/installation/#homebrew.
- Open a terminal window.
- Enter
xcode-select --install
to install the Xcode Command Line tools. - Enter
gem install rubyzip '1.2.1'
to install therubyzip
module. - Enter
gem install nokogiri '1.8.1'
to install thenokogiri
module.
Install the zip
and nokogiri
gem modules in a Windows environment
zip
and nokogiri
gem modules in a Windows environmentTo install the zip
and nokogiri
gem modules in a Windows environment, follow these steps:
- Install Ruby version 2.4.2. For more information, see https://rubyinstaller.org/downloads/.
- Open a command prompt.
- Enter
gem install rubyzip '1.2.1'
to install therubyzip
module. - Enter
gem install nokogiri '1.8.1'
to install thenokogiri
module.
Collect the images
- Extract the AndroidImageCaptureTool file from the Android SDK package to your local path.
- 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>
- 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/
- The terminal will prompt: "Automatically find and update the layout xml files with attributes src, foreground, background? [Y/N]:" Type
Y
and pressEnter
. - 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:
- Access the xml file within Android Studio and display the xml in Preview mode.
- Take a screenshot of image in Preview mode.
- Eliminate the background by using GIMP or any image editing software tool.
- Save the image without a background as a .png.
- Add the image to the images folder created in step 3.
Upload images to Replay
- Rename your images folder created in Step 3 to replayImages and zip this folder.
- On your Replay portal, go to the Organization tab and click on Manage Accounts.
- Click on the Company Settings tab.
- Scroll until you see Image package
- If a timestamp is present, click on the timestamp to download all the images folder from the organization.
- Unzip the downloaded folder.
- Add the contents of the image folder created in Step 3 (the pictures from the Android application).
- Zip it back up and name it
imagesReplay.zip
. - On the portal, click on Edit at the bottom right corner of the page.
- Click on Change the file by the timestamp for the Image package
- Click Browse, select the
imagesReplay.zip
folder from your machine, and click Upload. - Important: Wait until the timestamp changes. Only after the timestamp changes, click Save.
- Return to your session, your images should display now.
Your images should display on your Replay session.
Troubleshooting
- If your image is still missing from the Replay session, view these troubleshooting steps for Images are missing in a Replay session.
- The Android Image Capture tool doesn't create SHA2 images files. To capture SHA2 files, you can use the Tealeaf Target Simulator.
Updated about 1 month ago