Custom GMA binary archive build

If you are planning to build Genero Mobile for Androidâ„¢ extensions for your GMA project, you need to do this using Android Studio. Follow this procedure to extend GMA.

Note: When using GMA user extensions, you need to build the Java binaries for the final custom GMA .apk, as well as the user-extension.jar library, to compile Genero sources using IMPORT JAVA user-extension. For a complete overview, see Packaging custom Java extensions for GMA.
Important: Android Studio must be installed, and minimum Android development skills are required to perform this task.
  1. Locate the original GMA binary archive on your computer. If using Genero Studio, it is found in the GMADIR/gma/artifacts directory. The GMADIR variable is set in the Genero Studio configuration settings. If you are not using Genero Studio, the GMA binary archive is provided as a separate package.

    The GMA binary archive consists of a file named fjs-gma-<version>-<build>-android-scaffolding.zip. Version 1.30.00 or later is required.

    This file contains the original GMA core binary and the sub-project to build custom extensions.

  2. Create a project directory, for example extension-example/gma, to where you extract the GMA scaffolding archive.
  3. Unzip the fjs-gma-<version>-<build>-android-scaffolding.zip archive into extension-example/gma/project.
  4. In Android Studio, open the project from extension-example/gma/project.
    Note: In the Android Studio Project view, under the extension library, you can find the TestExtensionActivity.java source file: This is a sample activity to test the extension bundled in the scaffold project. This class is provided for testing purpose and sample. Rename it and change the code for your own purpose, or replace it with your own extension source.
  5. Define the extension module package name in the Android manifest file.

    In the Android Studio Project view, under the extension directory, open the AndroidManifest.xml file. Modify the value of the package attribute of the manifest node:

    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.gma.extension">
    Note: The package name must be a Java-language-style package name, for example, in the format of "com.gma.extension". The package name identifies your extension library, it is not the name used to build a final app in Genero Studio.
  6. Add your Java sources to this Android Studio project, under the extension library.
  7. If required, add external .jar libraries to the project: Copy the additional jar libraries into extension-example/gma/project/extension/libs. These jar libraries will be included when building the project.
  8. In Android Studio, build the project in release or debug mode.
    This creates the custom extensions binaries to build the final .apk and the extension.jar file in extension-example/gma/project/extension/build/libs. The extension.jar file contains Java classes that are callable from Genero BDL. The extension.jar file is required to compile Genero source code using IMPORT JAVA extension.
    Note: The project build in Android Studio will also create the customized GMA .apk. However, this step is done explicitly later, either from Genero Studio, or by using the gmabuildtool command.
  9. Build your custom GMA .apk with your custom extensions.
    If using Genero Studio, perform the following steps:
    1. Modify the CLASSPATH environment variable to include the extension.jar file.
      This is required to let the Genero compiler find your Java classes.
    2. Modify the GMADIR configuration variable to point to the extension-example/gma/project directory.
      This is required to let Genero Studio use your customized GMA binary to build apps. For more information, see the Configuration for extending Genero Mobile for Android topic in the Genero Studio User Guide.
    If using gmabuildtool to build apps from the command line:
    • Change directory to extension-example and call the gmabuildtool to build and bundle your final .apk file with the required options provided by the tool: gmabuiltool will use by default find GMA binary files and resources in the current working directory. For more details about gmabuildtool usage, see Building Android apps with Genero.
  10. Deploy the new GMA Android application package (.apk) on the device.
    • When using Genero Studio, the apk packages to be installed on the device are referenced from the GMADIR environment variable.
    • If not using Genero Studio, you can use the Android debug bridge (adb) command-line utility included with Android SDK to install the package to your device.