AddAndroidApp.jar script

Use AddAndroidApp.jar from the command line to instrument the application under test (AUT) and add it the test workbench.

If the AddAndroidApp.jar runs successfully, it returns an exit code of 0. Otherwise, it returns an exit code of 1.

Type the following command to learn about mandatory and optional parameters for the AddAndroidApp.jar command line tool.

java -jar AddAndroidApp.jar options
Table 1. Command line options
Command-line arguments and option Description
-w Workbench URL, which includes the IP address and port, for example, http://127.0.0.1:7878
Android application (.apk) The name of the Android app, for example, Calculator.apk. You can include multiple .apk files on the command line.
-c

Closes the test workbench after all of the apps have been added to the workbench, for example, eclipse -launcher.appendVmargs -vmargs -Dcom.ibm.rational.test.lt.services.server.moeb.CLI=true. This option requires that the workbench be launched with the com.ibm.rational.test.lt.services.server.moeb.CLI system property set to true.

To close the workbench automatically, use the Eclipse preference General > Startup and Shutdown and check Confirm exit when closing the last window.

-d Description. The text for the description for this application. The text will be displayed in the Mobile and Web UI Applications editor in the workbench.
-f Forcibly rebuild. If the exact same version of the Android application was already added to the workbench, the application is forcibly rebuilt another time.
-m .ma file. The workspace folder where the .ma resource for this application is created. This option is ignored if the workspace folder is not found.
-o Output folder. The local folder where the instrumented applications are downloaded to.
-v Version. Displays the version of the AddAndroidApp.jar tool.
-alias The alias from the keystore to be used to sign all of the applicationss that are produced
-keepdata Keep application data during installation on the device. Use this with signing options as it requires the same signature as the original application.
-keystore keystore The local path of the keystore that contains the private key to be used to sign all of the generated applicationss.
-aliaspassword alias-password The password of the alias.
-keystorepassword keystore-password The password of the keystore.

Examples

Run the following command to instrument an AUT, such as Calculator.apk and add it the workbench:

java -jar AddAndroidApp.jar -w http://192.0.2.24:7878 Calculator.apk

Run the following command to instrument multiple applications and add them to the workbench. Simply include the names of the .apk files to the command line, as follows:

java -jar AddAndroidApp.jar -w http://192.0.2.24:7878 Calculator.apk MySimpleApp.apk MySecondApp.apk

Run the following commands to start the workbench, instrument the AUT, and close the workbench:

eclipse -launcher.appendVmargs -vmargs -Dcom.ibm.rational.test.lt.services.server.moeb.CLI=true
java -jar AddAndroidApp.jar -w http://192.0.2.24:7878 -c Calculator.apk
Note: You need to close the workbench after command-line execution of tests because the same workspace cannot be used by two instances of the workbench. See http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Freference%2Fmisc%2Fruntime-options.html for additional details about additional Eclipse runtime options. To prevent the closing of the workbench from prompting you with the confirm exit dialog, go to the Eclipse preference General > Startup and Shutdown and select Confirm exit when closing last window.

Run the following command to instrument the AUT and download the generated application to a local folder:

java -jar AddAndroidApp.jar -w http://192.0.2.24:7878 -o localdir Calculator.apk
Feedback