Using the AppConnect for Android Wrapping Tool in CLI mode

Using the wrapping tool in CLI mode involves these high-level tasks:

Before you begin 

Overview 

Using the wrapping tool involves these high-level tasks:

  1. Providing developer settings

  2. Setting the keystore

  3. Wrapping and signing the app

Next steps 

After successfully wrapping and signing your apps, do the following:

The paths are documented using the Windows format. Use the format that is appropriate to your OS.

Example  

  • On Windows: C:\Users\username\AppData\Local\Android\SDK

  • On macOS: /Users/username/Library/Android/SDK

Providing developer settings

When you first use the wrapping tool, provide the necessary developer settings to the wrapping tool.

Enter the following at the command prompt:

java -jar path\wrap-tool.jar -android-SDK-path SDKpath

Where:

  • path\ wrap-tool is the location and name of the wrapping tool jar file.
  • SDKpath is the location of the Android SDK.

Example  

java -jar C:\Users\testuser\Downloads\wrap-tool-1.14.18-9.2.0.0.4.jar -android-SDK-path C:\Users\testuser\AppData\Local\Android\Sdk

Accept the license agreement presented.

You are not prompted to accept the license agreement if you had accepted it in a previous version of the tool.

Example  

Do you agree with all terms and conditions? [Y/n] y

Android SDK path update: success!

### To run wrapping tool in UI mode

Usage: java -jar wrap-tool.jar

### To run wrapping tool in CLI mode please specify proper action

Usage: java -jar wrap-tool.jar (-wrap || -sign-only || -help) -in appName.apk [wrapping arguments]

Setting the keystore

Set the keystore to sign the wrapped app with your enterprise private key. The keystore file is saved for all subsequent app signing.

Before you set the keystore, create a keystore.txt file that contains the location and name of the keystore file, the store password, the key alias, and the key password. It is recommended to create the keystore text file so that the passwords are not visible in the CLI.

The keystore text file contains the following content:

path\fileName.keystore ks-pass ks-key-alias key-pass

Where:

  • path\ wrap-tool is the location and name of the wrapping tool jar file.
  • path\fileName is the location and name of the keystore file.

  • ks-pass is the store password.

  • ks-key-alias is the key alias.

  • key-pass is the key password.

Enter the following at the command prompt to set the keystore:

java -jar path\ wrap-tool.jar -keystore @path\keystore-file.txt

Where:

  • path\ wrap-tool is the location and name of the wrapping tool jar file.
  • path\keystore-file is the location and name for the keystore text file.

Example  

java -jar C:\Users\testuser\Downloads\wrap-tool-1.14.18-9.2.0.0.4.jar -keystore @C:\Users\testuser\Downloads\keystore-file.txt

checking keystore settings...

applying keystore settings...

Keystore update: success!

### To run wrapping tool in UI mode

Usage: java -jar wrap-tool.jar

### To run wrapping tool in CLI mode please specify proper action

Usage: java -jar wrap-tool.jar (-wrap || -sign-only || -help) -in appName.apk [wrapping arguments]

Wrapping and signing the app

The wrapping tool in command line interface (CLI) mode uses the following defaults:

  • Wrapper version: The current AppConnect version. If the AppConnect version is 9.2.0, the associated AppConnect wrapping tool defaults to the 9.2.0 wrapper version.

  • Wrapping mode: Generation 2.

  • Wrapping options:
    • -allowAccessGoogle, which allows the app to use Google Play services
    • -allowNativeCode, which allows the app to use native libraries

    • -allowUnwrappedAPIs, which allows

Enter the following command at the command prompt to wrap and sign an app:

java -jar path\ wrap-tool.jar -wrap -in path\appName.apk [wrapping options]

Where:

  • path\ wrap-tool is the location and name of the wrapping tool jar file.

  • path\appName is the location and name of the APK file.

  • wrapping options are any optional arguments you want to use for wrapping the file.

The following table describes the available arguments to use for wrapping an app.

Table 8.  Available arguments

Flag

Description

-ignoreSqlCipher

See Encryption of the SQLCipher database.

-allowIntentAction

See Receiving information from outside the AppConnect container.

-enableCrashlytics

Enables Crashlytics library. See Firebase Cloud Messaging and Crashlytics support.

-disableArm64

See 64-bit support.

-keepJavaNativesLazyLinking

See Linking native Java methods

Example :

C:\Users\testuser>java -jar C:\Users\testuser\Downloads\wrap-tool-1.14.18-9.2.0.0.4.jar -wrap -in C:\Users\testuser\Downloads\unTransformedApps_9.2.0.0.14\Box.apk

selected the version 9.2

running transformer version 9.2 for the file C:\Users\testuser\Downloads\unTransformedApps_9.2.0.0.14\Box.apk

wrapping exit value: 0

 

...<JSON output>

 

zipalign exit value: 0

signing exit value: 0

Signed