Android developers can customize and configure Android build environments using the following information:
If an application is built in Kony Visualizer for the Android platform, a corresponding native Android project is generated.
Changes made to the project can be compiled in the command line using gradle assembleDebug
, gradle assembleRelease
by navigating to the native Android application folder in the command line.
To access the generated Android project, do the following:
<WorkSpace>\temp\<AppID>
.
<WorkSpace>\temp\<AppID>\build\luaandroid\dist\<AppID>
. <WorkSpace>\temp\<AppID>\build\luatabrcandroid\dist\<AppID>
. If the application package name is com.xyz.sample and the Application ID is SampleApplication, the Kony Visualizer build process generates a Main Activity Java source file with Application ID as its name in the following path:
<WorkSpace>\temp\SampleApplication\build\luaandroid\dist\SampleApplication\src\com\xyz\sample\SampleApplication.java
<WorkSpace>\temp\SampleApplication\build\luatabrcandroid\dist\SampleApplication\src\com\xyz\sample\SampleApplication.java
A developer can add custom code and add/modify overridden Android activity life cycle methods such as onCreate(), onStart(), onResume(), onPause(), onStop(), onRestart(), onDestroy(), onNewIntent(Intent), and so on. A developer can also invoke any third-party APIs directly from overridden life cycle methods of the class.
While enhancing the Java file, a developer needs to remember the following points:
A developer can perform custom tasks before and after compiling the generated native Android application using androidprecompiletask.xml and androidpostcompiletask.xml.
For example, a developer can perform the following pre-compile tasks using androidprecompiletask.xml:
<AppID>\src\<packagepath>\
folder .For example, you can perform the following post-compile tasks using androidpostcompiletask.xml:
A developer can copy these XMLs into Kony project workspace base directory with same names (androidprecompiletask.xml and androidpostcompiletask.xml).
A template androidprecompiletask.xml file is available at <WorkSpace>\temp\<AppID>\build\luaandroid\extres
. This XML is available under extres
folder after building any sample project. This XML file contains build parameter information useful to perform the tasks explained in the example above.
Note: The pre- and post- compile Ant tasks can support integration with external tools such as binary protection tools, static analyzer tools, and so on.
Since Kony's build system is based on Gradle, integrate third party Android library format (.aar) files into the project by copying .aar files to the required path.
Similarly, third-party java class (.jar) files can also be integrated into the project by copying .jar files to the required path.
<WorkSpace>\<Application>\resources\customlibs\lib\android
<WorkSpace>\<Application>\resources\customlibs\lib\tabrcandroid
If the library format's .aar or .jar file depends on other libraries, add them to your project.
Important: If the included dependencies have an associated order among them, they must be added in same order. For more information on dependency order, see Dependency order.
For Kony Visualizer version 7.3, use the build.gradle entries to Suffix Gradle property to add dependencies. For example, if your .aar file or .jar file depends on Appcompat and Play Services Analytics, you can add the following dependency entries.
For information on Gradle properties, see Set Native App Properties.
For Kony Visualizer version 7.2 and earlier, add dependencies by adding script code to androidprecompiletask.xml. For example, the following concatenates the Appcompat and Play Services Analytics entries to the build.gradle file.
< concat destfile = "${app.dir}/build.gradle" append = "true" > $ { line.separator } dependencies.compile 'com.android.support:appcompat-v7:24.0.0' < /concat>
< concat destfile = "${app.dir}/build.gradle" append = "true" > $ { line.separator } dependencies.compile 'com.google.android.gms:play-services-analytics:10.0.0' < /concat>
Copyright © 2013 Kony, Inc. All rights reserved. |