Deployment#

Deploying to Devices#

Deploy configurations in the Project mode Run Settings handle the packaging of the application as an executable and copying it to a location you want to run the executable at. The files can be copied to a location in the file system of the development PC or a device.

  • Deploying Applications to Android Devices

    When you deploy the application to an Android device, PVRStudio copies the application files to the device.

  • Deploying Applications to Embedded Linux Devices

    When you deploy the application to a generic Linux-based device, PVRStudio copies the application files to the connected device. You can test and debug the application on the device.

  • Deploying Applications to QNX Neutrino Devices

    When you deploy the application to a QNX Neutrino device, PVRStudio copies the application files to the connected device. You can test and debug the application on the device.

Deploying Applications to Android Devices#

On Android, applications are distributed in a specially structured type of ZIP package called an APK. PVRStudio supports the following methods of deployment for Android applications:

  • As a stand-alone, distributable application package (APK).

To specify settings for application packages, select Projects > Build Android APK > Details.

For more information about options that you have for running applications, see Specifying Run Settings for Android Devices.

Packaging Applications

Because bundling applications as APK packages is not trivial, PVRStudio provides all deployment functionality to create the necessary files and to bundle them into an APK:

  • Java files, which serve as the entry point into your application and that automatically execute the native code in your application.

  • AndroidManifest.xml, which provides meta-information about your application.

  • Other XML files, which specify the dependencies of your application.

  • Resource files.

  • Libraries, which can be included in the project depending on the deployment method that you select.

  • Gradle wrappers that are needed to download and use Gradle.

  • Gradle script that is needed by Java IDEs, such as Android Studio. It allows the user to extend the Java part without copying our Java sources. It also allows the IDEs to provide code completion, syntax highlighting, and so on.

The Gradle wrappers and scripts are bundled only if you use Gradle to build the application packages. For more information, see Connecting Android Devices.

To view the packages that the PVRStudio created, select the Open package location after build check box.

The packages are deployed on the connected Android devices. To switch the device used as a default device for the selected kit, select Projects > Run > Reset Default Devices. The setting applies until you restart PVRStudio. For more information, see Selecting Android Devices.

For more information about the androiddeployqt tool, see Deploying an Application on Android.

Specifying Settings for Packages

PVRStudio uses the information in the project to create APKs. For more information about the variables that you can set in the project file to tailor the APK, see Deploying an Application on Android.

You can view information about what PVRStudio is doing in the Compile Output pane. To view additional information, select the Verbose output check box.

Selecting API Level

In the Android build SDK field, you can select the API level to use for building the application. Usually, you should select the newest API level available.

This field does not specify the minimum supported API level nor the target API level, which you can specify in the Android manifest file. For more information about Android API levels, see What is API Level?.

Signing Android Packages

To publish your application, you must sign it by using a public-private key pair that consists of a certificate and a corresponding private key and is identified by an alias. The key pair is used to verify that the future versions of your application are actually created by you.

Warning: Keep the key pair in a safe place and take back up copies, because you cannot update the application if you lose the key pair.

You can use PVRStudio to generate a keystore and a self-signed certificate. The generated certificate has the structure of an X.509 v3 digital certificate. It contains information about the version, serial number, and validity period of the certificate, the ID of the algorithm that is used to encrypt the data, the organization that issued the certificate, and the subject (owner) of the certificate. In case of a self-signed certificate, the issuer and owner of the certificate are the same. In addition, the certificate contains information about the algorithm that is used to sign the certificate, as well as the signature of the certificate.

The keystore is protected by a password. In addition, you can protect each alias with its individual password.

When you sign an Android application, you must select a keystore that contains certificates and a certificate alias from the keystore. The public key (certificate) for the alias is embedded into the APK during signing.

To create a keystore and a self-signed certificate:

  1. In the Keystore field, select Create to create a new keystore that contains one key pair in the Create Keystore and a Certificate dialog:

    ../_images/pvrstudio-android-certificate.png
  2. In the Keystore group, enter a password to protect the keystore.

  3. In the Certificate group, specify the key size and validity period of the certificate. You can specify a separate password to protect the key pair or use the keystore password.

  4. In the Certificate Distinguished Names group, enter information about yourself and your company or organization that identifies the issuer and the owner of the key pair.

  5. Select Save.

  6. In the Keystore File Name dialog, enter a name for the keystore and select a location for it.

  7. In the Keystore dialog, enter the keystore password to create the key pair in the keystore.

To sign an Android package by using a key pair, specify settings in the Sign package group:

  1. In the Keystore field, select Choose to select an existing keystore.

  2. In the Certificate alias field, select an alias from the list of key pairs that the keystore contains.

  3. Select the Sign package check box to use the alias to sign the Android package.

Adding External Libraries

PVRStudio automatically detects which libraries the application uses and adds them as dependencies. If the application needs external libraries, specify them in the Additional Libraries field. The libraries are copied into your application’s library folder and loaded on startup.

For example, to enable OpenSSL in your application, add the paths to the required libssl.so and libcrypto.so libraries to the Additional Libraries field.

Editing Manifest Files

You do not need an Android manifest file until you want to publish the package in an application store. To specify additional settings for APK packages, you can create an Android manifest file and edit it in PVRStudio. Select Create Templates to create the file and to open it in the Android Manifest Editor.

"Android Manifest Editor"
  1. In the Package name field, enter a package name for the application. The application is launched by an automatically generated Java launcher that is packaged with the application into an Android package (.apk). For more information, see Android Application Fundamentals.

  2. You can specify an internal version number for the package in the Version code field. It is used to determine whether one version of the application is more recent than another. In the Version name field, specify the version number that is shown to users.

  3. In the Minimum required SDK field, select the minimum API level required to run the application. The minimum supported API level is android-9.

  4. In the Target SDK field, select the targeted API level of the application. This affects the activation of some compatibility features in the OS. The value used by the androiddeployqt tool by default is 14, which means that the overflow button in the system navigation bar will not be enabled by default.

  5. In the Application group, you can give the application a name and select an icon for it. The three icon fields can contain different versions of the icon with low, medium, and high DPI values, from left to right. You can also give an activity a name and select the activity to run.

  6. In the Permissions field, you can specify the permissions that your application needs. Users are asked to grant the permissions when they install the application. Android OS then grants the application access to the appropriate data and features.

  7. To add permissions, select them in the list, and then select Add.

Select the XML Source tab to edit the file in XML format.

Deploying Applications to Embedded Linux Devices#

You can specify settings for deploying applications to generic Linux devices in the project file. You can view the settings in the Run Settings. The files to be installed are listed in the Deployment step, the Files to deploy field. The Local File Path field displays the location of the file on the development PC. The Remote Directory field displays the folder where the file is installed on the device. Text in red color indicates that the information is missing.

When you run the application, PVRStudio copies the necessary files to the device and starts the application on it.

Generic Deployment Steps

"Deploy to embedded Linux"

When you run the application on the device, PVRStudio deploys the application as specified by the deploy steps. By default, PVRStudio copies the application files to the device by using the SSH file transfer protocol (SFTP), as specified by the Upload files via SFTP step.

If you have a lot of data to copy, select Details in the Upload Files via SFTP step, and then select the Incremental deployment check box. PVRStudio takes note of the deployment time and only copies files that have changed since the last deployment. However, when you make major changes on the device, such as removing files from the device manually or flashing a new disk image, or when you use another device with the same IP address, deselect the check box once, to have PVRStudio deploy all files again.

To only create a tarball and not copy the files to the device, select Add Deploy Step > Create tarball. Then remove all other deploy steps.

The Deploy tarball via SFTP upload step specifies that PVRStudio uploads the tarball to the device and extracts it.

The Check for free disk space step is by default the first deploy step. Use it to find out whether the remote file system has enough space left to deploy your project. Errors due to lack of disk space can otherwise be hard to detect.

Note: If the SFTP upload fails, make sure that the remote device has SFTP enabled in its SSH daemon. Some versions of Dropbear that come without SFTP support will crash when an SFTP upload is being attempted. This is not a bug in PVRStudio.