Applies to Kony Visualizer Classic.
You can build a native library for an app that is created in Kony Visualizer. Once you generate the native library, you can embed the native library in your platform specific native applications. For example, if you generated a native library for Android, you can use the library in Android native application.
The Native Library feature of Kony Visualizer uses some Kony application APIs and a few native APIs that establish the communication between Kony library and the native application.
The iOS library is created in the .zip format while the Android library is created in the .aar format. If there are any errors during the process of library creation, the Console section of Kony Visualizer logs the issues.
To generate native library for your app, do the following:
To integrate native library into a native app, do the following:
Location of aars in Kony Visualizer project:
Mobile channel: <workspace>/temp/<AppID>/ build/luaandroid/dist/<AppID>_aars
Tablet Channel: <workspace>/temp/<AppID>/build/luatabrcandroid/dist/<AppID>_aars
Note: Hyperlink of the generated library artifacts location will appear in the build console of Kony Visualizer.
flatDir { dirs 'libs' }
fileTree(dir: 'libs', include: '**/*.aar') .each { File file - & gt; dependencies.add("implementation", [name: file.name.lastIndexOf('.').with { it != -1 ? file.name[0.. & lt; it] : file.name }, ext: 'aar' ]) }
<workspace>/temp/<AppID>/ build/luaandroid/dist/<AppID>
<workspace>/temp/<AppID>/build/luatabrcandroid/dist/<AppID>
Note: Library application build.gradle file may contain multiple dependencies scope, so you must add all gradle dependencies under multiple dependencies scope of library application . If there are any external(remote) dependencies, then you should mention corresponding repository and url information in the native project main build.gradle file under allprojects repositories scope .
Once you incorporate the changes mentioned in the steps above, the gradle file looks like the image below.
Sync gradle changes of app module to add library artifacts.
When you build a Kony app as Android library, native framework libraries (.so files)are bundled for supported 32 and 64-bit architectures in the library . For example, 32-bit architectures armeabi-v7a, x86, 64-bit architectures arm64-v8a, x86_64, and so on.
You can reduce the binary size of the native app by specifying the specific architecture of the library you want to support in your native app. You can do that by adding appropriate ndk filters to the app module build.gradle file of the native app.
android { defaultConfig { ndk { abiFilters "armeabi-v7a" } } }
In this example, only armeabi-v7a architecture is bundled resulting in reduced binary size.
You can add more architectures you need by separating them with a comma. For example,
android { defaultConfig { ndk { abiFilters "armeabi-v7a, x86" } }
You can integrate the native library in iOS using the integrateiOSLibrary tool.
./integrateiOSLibrary -proj <path to xcodeproj> -lz <path to Generated iOS Native Library>
Note: In case of xcworkspace, pass one of the projects in the workspace as an argument to the executable.
Note: All frameworks of Kony are dynamic frameworks. Hence, all the frameworks should get added to both Embed Frameworks and Link Binary with Libraries sections of App Targets of the provided native XCode project.
The following table provides information on options that you can execute using the integrateiOSLibrary tool.
Options | Requirement | Details |
---|---|---|
--help | Optional | Executable Information about usage and options. |
-g | --groupname | Optional | Group Name in Xcode Project to which frameworks need to be added. If a new group name is given, the tool will create that group in the Xcode project and adds all the frameworks to that group.
If the group name is not provided, a group with generated library zip name will be created.
./integrateiOSLibrary -proj <path to xcodeproj> -lz <path to Generated iOS Native Library> -g <group name> |
-lf | --libraryframeworks | Optional |
If frameworks generated with wrappers around library APIs need to be added to any framework target, pass respective framework targets using --frameworkTargets and respective frameworks(containing wrappers) using
|
-f | --frameworkTargets | Optional |
If library APIs must be used in any framework target, provide that framework target as an argument. Tool will add the required frameworks which has library APIs to the provided framework targets. Multiple Framework Targets can be provided separated by comma
|
--debug | Optional | Prints debug statements |
-clean | Optional |
Removes all the Kony Frameworks added to the project. Argument : Pass xcodeproj to which kony frameworks are added and group name in the xcodeproj to which frameworks are added using -g option.
|
-proj | Mandatory | Xcode Project |
Example
. / integrateiOSLibrary - proj / Users / abcd / iOSNativeProject / iOSNativeProject.xcodeproj - lz / Users / abcd / iOSNativeLibrary.zip
Note: If any of Kony frameworks are added manually to the XCode project, make sure to delete the frameworks manually before running the executable.
Once you build the native library for the application in Kony Visualizer, you must copy the generated .zip files of the application to the iOS native project. The generated library artifacts are present in a .zip file with the AppID (<AppID>.zip).
The location of the file is
<Workspace>/temp/<AppName>/build/server/(iphonekbf (or) ipadkbf (or) universalkbf)
Note: Path of the generated library artifacts location will appear in the build console of Kony Visualizer.
When you unzip the .zip file, it contains the following files.
To add frameworks to the iOS native project, do the following:
Note: All the frameworks will be available in both Embedded Binaries and Link Binary with Libraries sections in Build Phases of the App target.
Once you build the native library for the application in Kony Visualizer, you must copy the generated library artifacts of the application to the Windows native project.
The generated library artifacts are available in the following locations:
<workspace>/temp/<AppID>/build/windows10/Windows10Mobile/<AppID>
<workspace>/temp/<AppID>/build/windows10/Windows10/<AppID>
To link Kony App to the Windows native library, do the following:
<workspace>/temp/<AppID>/build/windows10/Windows10Mobile/<AppID>
<workspace>/temp/<AppID>/build/windows10/Windows10/<AppID>
Android:
iOS:
The following features are not supported for the iOS platform:
NSString *konyLibraryPath = [[[[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent:@"Frameworks"] stringByAppendingPathComponent:@"AppID.framework”];
Note: AppID refers to the AppID in Project settings > Application > ID of Viz Project.
NSBundle *konyLibraryBundle = [NSBundle bundleWithPath:libraryPath];
Bundle for accessing resources should be konyLibraryBundle instead of [NSBundle mainBundle]
Copyright © 2013 Kony, Inc. All rights reserved. |