Requirements for Android application development with Kanzi

When you are developing Kanzi applications for Android you can use Android Studio, the Clang toolchain, and the Gradle build system. This development approach is tested on:

  • Ubuntu/Linux 18.04.1

  • Windows 10

To develop Kanzi applications for Android, you need:

  • 64-bit JDK 11 or 17.

    We recommend using JDK 17 that is installed with Android Studio.

  • Gradle and Android Studio versions depends on the JDK version:

    Tool

    JDK 11

    JDK 17

    Gradle

    6.7.1

    7.6.2 or newer

    Android Gradle plugin

    4.1.3

    7.4.2

    Android Studio

    4.1.3 or newer stable version

    Electric Eel or newer stable version

    You can download and install Android Studio from https://developer.android.com/studio.

  • CMake 3.10.2.4988404 from Android Studio or newer

  • Android API level:

    • Kanzi Android framework (droidfw) requires Android API level 26 (Android version 8.0.0) or newer.

    • Kanzi application framework (appfw) requires Android API level 21 (Android version 5.0) or newer.

  • Java language version:

    • Kanzi Android framework (droidfw) requires Java 8 (1.8) or higher.

    • Kanzi application framework (appfw) requires Java 7 (1.7) or higher.

To use Java Kanzi Engine plugins from Kanzi Studio, you need:

To deploy to the Android Emulator an application that uses OpenGL ES API level higher than 2.0, in the Android Emulator enable OpenGL ES 3.0. See Enabling OpenGL ES 3.0 in the Android Emulator.

Setting up the Android build environment

You must set up your Android build environment before you can deploy a Kanzi application to Android. To set up the build environment in Android Studio, you need an Internet connection.

To set up the build environment:

  1. In the Android Studio Welcome screen, select More Actions > SDK Manager.

    ../../_images/android-studio-configure.png
  2. In the SDK Manager window in the SDK Tools tab select:

    • NDK (Side by side)

    • CMake

    Click OK.

    ../../_images/select-cmake-and-ndk.png
  3. Open Kanzi Studio and in the main menu select Edit > User Preferences and in the Advanced tab click Open Build Environment Configuration.

    ../../_images/open-build-environment-configuration.png
  4. In the Build Environment Configuration dialog make sure that these environment variables are correctly set:

    • ANDROID_HOME to the Android SDK path

      For example, C:\Users\<user>\AppData\Local\Android\Sdk.

    • (Optional) ANDROID_STUDIO to the Android Studio path

      Kanzi Studio uses this environment variable to open Kanzi applications for Android in Android Studio. For example, when you open Code Behind source from the Activity Browser.

      If not set, Kanzi Studio looks for Android Studio at C:\Program Files\Android\Android Studio\bin\studio64.exe.

    • JAVA_HOME to the 64-bit JDK path

      It is recommended to use the JDK which is bundled with Android Studio.

      For example, the most common locations for JDK are:

      • C:\Program Files\Android\Android Studio\jre

      • C:\Program Files\Android\Android Studio\jbr for Android Studio Electric Eel | 2022.1.1 and newer

    ../../_images/android-java-home-paths.png

    Kanzi Studio stores the environment variables in the %ProgramData%\Rightware\<KanziVersion>\kanzi_environment_variables.bat file. The Kanzi Command Prompt uses the environment variables set in this file. See Using the Kanzi Command Prompt.

Build process

This diagram shows the process that Kanzi uses to build an Android package.

../../_images/gradle-build.svg