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.
Android Studio must be installed, and minimum Android development skills are
required.
-
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
configuration settings. If you are not using Genero Studio, the GMA binary archive is provided as a
separate package.
The GMA binary archive consist of a set of files:
- fjs-gma-<version>-<build>-android-scaffolding.zip
: This file contains the original GMA core binary without custom extensions.
- fjs-gma-<version>-<build>-android-extension-project.zip:
This file contains the original GMA core binary and the sub-project to build custom
extensions.
Important: Version 1.20.00 is required.
-
Create a project directory, for example extension-example/gma/project, to
where you extract the GMA scaffolding archive.
-
Unzip the
fjs-gma-<version>-<build>-android-extension-project.zip
archive into the extension-example/gma/project directory.
-
In Android Studio, import the project from
extension-example/gma/project.
-
In Project view, under the extension directory,
find the AndroidManifest.xml file and open it in the Editor
window.
-
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.
-
Locate the testapp app in the project.
This is a sample activity to test the extension bundled in the scaffold project directly
within the Android Studio environment. You can build and run it for testing without modification.
You will then want to customize it to call and implement your own GMA extensions.
-
Add your Java sources to this Android Studio project, under the extension
library.
-
Modify testapp, to call your extension (see code for details), and build and
run for testing.
-
Build the project in release or debug mode.
This creates the extension.jar file in
extension-example/gma/project/extension/build/outputs. This jar file contains
Java classes that are callable from Genero BDL.
If using Genero Studio, perform the following steps:
-
Modify the CLASSPATH environment variable to include the extension.jar
file.
This is required to let the Genero compiler find your Java classes.
-
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:
- Provide the reference to the extension-example/gma/project directory in
the --build-project option. For more information, see Building Android apps with Genero.
- Change directory to extension-example and call the
gmabuildtool to build and bundle your final apk with the
required options provided by the tool.
-
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.