Package a mobile app

You must package your app before you can deploy it to a mobile device.

Before you begin

Make a list of files needed to run your app and the absolute path to where these files reside.

If you are packaging a GMI application, read about the GMIUSERDIR environment variable, to determine whether it should be set for your package.

About this task

If you created your project using the BAM Mobile Project (.4pw) or Mobile Project (.4pw) options, default package nodes were created for Androidâ„¢ and iOS devices. You should still read through this procedure to add directories and validate properties.

  1. Create a package node structured for your target mobile device. Right-click on a group node and select:
    • New package > Android to create a package for an Android device.
    • New package > iOS to create a package for an iOS device.
    • New package > iOS Simulator to create a package for an iOS simulator.
    The package node is added to the group, and the Platform property is set to the selected mobile platform.
  2. Define the package properties.
    Figure: Package properties

    Screen shot of Properties pane for a package node.
  3. For each physical directory on disk that contains files to be included in the package, identify a corresponding logical directory under the package node. If no corresponding logical directory exists, create the directory.
    1. If a new directory is needed, right-click on the package node and select New Directory.
    2. Define the properties for each directory added.
      Files are copied from the source directory to the destination directory. In the Source directory property, specify the directory where the file(s) come from. In the Destination directory directory, specify the target directory. The destination directory must be in the root directory.
      Note: In the default project of a new BAM Mobile Project (.4pw), both properties are set to $(ProjectDir)/bin. When the source and destination directories are the same, the packaging process does not have to copy, optimizing the packaging process.
    3. To include or exclude files from the source directory, add the criteria to the Included files or Excluded files properties.
    Figure: Directory properties

    Screen shot of Properties pane for a directory node.
  4. Confirm the Package rules. Right click on the package node and select Edit Package Rules.
    Note: You typically do not modify the package rules.
  5. Right click on the package node and select Build.
    Progress of the package build appears in the Output view.
    Important: You need an internet connection the first time you build an Android package. During this first build, an automated process will download and install Gradle with all necessary extensions into a directory in your user directory. Gradle is a project automation tool, find out more about Gradle at http://www.gradle.org.
    Figure: Build package

    Context menu showing Build menu option.
  6. Confirm the package is on your local file system.
  7. Validate this package by running the app on a device. Follow the instructions to Deploy a mobile app package for testing.
What to do next

The packaging of a GMA application is handled under the covers by the gmabuildtool, which uses a cache. This cache is created in a temporary directory and, if not managed, can grow to a significant size. You should take care to monitor the size of this cache and manually clean out the cache files, to ensure that it does not become too large in size. For more information about the gmabuildtool and the cache it creates, see the Genero Business Development Language User Guide.