Set up automatic app packaging and signing services

After you upload an app to Mobile Center, the server automatically attempts to package the app. This provides users with the option of selecting either a packaged app or the original version when running a test. To enable this functionality of automatic app packaging and signing by Mobile Center, the administrator needs to set up the packaging and signing services.

About app signing services

Whenever an app is repackaged with Mobile Center record and replay libraries, the app needs to be re-signed. By default, Android apps are signed with a debug certificate, and no additional action is required by the administrator. For iOS apps, or for Android apps that use services requiring a private key such as Google Maps or the authentication service, the administrator needs to set up Mobile Center to automatically re-sign apps. This is done by configuring the packager properties file.

You can also package and sign apps manually and then upload them to Mobile Center. For details see, Package an Android app manually or Package an iOS app manually.

Note: App signing services cannot be configured in the Administrator Settings page.

Configure app signing services for iOS apps

Before you start

The following are required for the automatic packaging and signing services:

  • Development certificate and development provisioning profile that includes a wildcard App ID. For more details on how to generate Apple assets, see iOS assets for signing apps, or see Apple Developer.
    For details on when iOS apps need to be signed, see iOS app signing.
  • A dedicated Mac machine, with a connection to the Mobile Center server. The following software should be installed on the Mac machine:
    • OSX 10.8/10.9, or macOS Sierra 10.12, High Sierra 10.13, or Mojave 10.14
    • Xcode 6 or higher
    • JRE for Mac (version 7.x or higher). The environment variable JAVA_HOME must also be set.

You can also use the packaging service to manually sign the Agents, or to sign and package an app. For details, see Package an iOS app manually.

Install the packager service

To install the packager:

  1. Download the iOS packager to a Mac machine. You can download the Packager Service by selecting your version of Mobile Center on ADM Marketplace
  2. Double click the iOSPackager.pkg file to start the installer (Admin permissions are required).
  3. Configure the Packager Service as follows:
    1. If the connection to the packaging service should be over SSL only, select Enable SSL.
    2. Provide the IP address of the Mac machine or the fully qualified domain name (FQDN).
    3. Give the service a meaningful name.
    4. Select the iOS developer certificate to be used for signing apps. The certificate must be installed on the Mac machine that you are using, and can be seen in the Keychain Access program.
    5. Select the provisioning profile. Note that the development provisioning profile must belong to the same Apple Developer account selected above.
    6. Specify a port for the packager service.
  4. You will be notified when the software is successfully installed. The packager service starts automatically and the UI opens in your browser.
  5. Prevent your Mac from sleeping. For details, see Apple support.
  6. Define the packager settings in Adminstration > SETTINGS. For details, see Define packaging settings in Mobile Center

Tip: To view version information, details of packaging services, or to download logs, click the about icon in top right of the packager UI. The packager UI can be accessed at:http/s://<packager server IP address>:port/instrumentation/

SSL connection

If you selected the Enable SSL option when installing the packaging service:

  1. Navigate to /opt/mc/packager/Security/keystore and copy the .p12 file to the Mobile Centerserver.
  2. On the Mobile Center server machine, run the following command to import the certificate:

    Windows

    <Path to your Mobile Center server installation folder>\server\jre\bin\keytool -importkeystore -srckeystore <name of file>.p12 -srcstoretype pkcs12 -srcstorepass password -srcalias hpmc -destkeystore <Path to your Mobile Center server installationfolder>\server\Security\keystore\trustStoreHpmc


    Linux:

    <Path to your Mobile Center server installation folder>/server/jre/bin/keytool keytool -importkeystore -srckeystore <name of file>.p12 -srcstoretype pkcs12 -srcstorepass password -srcalias hpmc -destkeystore <Path to your Mobile Center server installation folder>/server/Security/keystore/trustStoreHpmc

  3. In Adminstration > SETTINGS, make sure to use https as the packager protocol.

Add an additional service

When working with many devices and workspaces, you may need to use different signing services for your devices. For example, in iOS environments you can only sign up to 100 devices with a single certificate. In addition, you may need to provide a solution for one group, without having to rely on the certificate from another group.

The administrator can define multiple packaging services, in addition to the primary packaging service, and then assign them to different workspaces. For details, see Multiple packaging services.

To add an additional service to the packager service:

  1. Navigate to the installation folder /opt/mc/packager/ and run the add new service script.
  2. Provide a name for the new service, and the service port. You will also be prompted for the name of the Apple Developer certificate, and the path to the provisioning profile.

    The service is added as a new tab to the packager UI.
  3. Add the additional service to the iOS packaging service settings in Adminstration > SETTINGS. For details, see Define packaging settings in Mobile Center.

To remove a service, navigate to the installation folder /opt/mc/packager/ and run the remove service script.

To restart or uninstall the packager service:

When you install the packager service, the service starts automatically and continues to run at all times. If, for some reason, the service is not running and the UI is not available at http/s://<packager server IP address>:port/instrumentation/, you can restart the service by running the restart script in the installation folder /opt/mc/packager/.

To uninstall the service, navigate to /opt/mc/packager/ and run the unistall script.

To automatically sign and distribute Agents

To simplify and support automation of the Agent app re-signing process, once the packaging service is set up, you can sign and distribute the agents. The re-signed Agent apps will be distributed to all connectors that are currently connected the Mobile Center server, as well as any connector that connects to the server in the future.

Select DEVICE LAB> CONNECTORS. In the sign and distribute agents section, click START. The Agents are always signed with the primary packaging service. For more information , see View and manage connectors (Admin only) and Multiple packaging services.

The re-signed Agent apps are not installed on the connected devices until the connector is restarted, or the devices are reconnected.

Back to top

Configure app signing services for Android apps requiring a private key

In general, automatic packaging of apps after upload to Mobile Center requires no additional action.

If your app uses services that require a private key, such as Google Maps or the authentication service, you need to sign your app using your own private key. To enable Mobile Center to automatically sign your app with your own private key during the packaging process, you need to first set up the app packager for signing Android apps.

By default, Mobile Center signs your app with a debug certificate. If your app uses services that require a private key, for example Google Maps or the authentication service, you need to sign your app with your own private key during the packaging process.

To configure Mobile Center to automatically sign your app with your own certificate:

  1. Open the packager properties file on the Mobile Center Server machine:

    Linux: <Path to your server installation folder>/server/conf/packager.properties
    Windows: <Path to your server installation folder>\server\conf\packager.properties

  2. Enter the following information:

    ANDROID_KEYSTORE_PATH = The path to your key store, which is a binary file containing your set of private keys.

    ANDROID_KEY_PASSWORD = The password for the private key that you will use to sign the app.

    ANDROID_STORE_PASSWORD = The password for the key store.

    ANDROID_ALIAS_NAME =The name used to identify the private key entry in the key store.

  3. Note:  All four values are required. If any of the values is left empty, the app packaging process will fail.

Define packaging settings in Mobile Center

You can set up Mobile Center so that when a user uploads an app, Mobile Center automatically packages the app with record and replay libraries.

  1. In Mobile Center, click Administration and select the SETTINGS tab.
  1. In the packaging service sections (for Android or iOS), set the IP address and port of the machine that will be used for repackaging the app. Set the protocol type to HTTP or HTTPS, depending on whether the connection is secure. By default, the Android package service machine is set to localhost.

    iOS only: use the Add Service button to add other packaging services in addition to the primary one. For these additional services, you also indicate the workspace that will use this service. Use the Remove button to remove packaging services that you added. You cannot remove the primary service.

For Android apps that use services requiring a private key, and for iOS apps, you also need to set up app signing services described above.

Back to top

Troubleshooting the app packager

There may be times when the packaging process does not succeed When Mobile Center is unable to create a packaged version of the app, a notification is displayed. Provided that you are not using a test created with Mobile Center 1.52 or earlier, nor testing a hybrid app with a test created with Mobile Center 2.00, packaging is not essential for testing.

Packaging may not succeed for the following reasons:

See also: