Kanzi 3.6.6 migration guide

Use this migration guide to update Kanzi applications from Kanzi 3.6.4 and 3.6.5 to Kanzi 3.6.6.

Migrating Kanzi 3.6.4 and 3.6.5 applications to use the Android platform package

The Android platform package does not support the V8 library. Before you migrate your Kanzi application, disable or remove JavaScript from the Kanzi application that you want to migrate.

To migrate Kanzi 3.6.4 and 3.6.5 applications to use the Android platform package:

  1. Extract the Kanzi Android platform package zip file to the <KanziWorkspace> directory. When you extract the zip file, skip duplicate files instead of overwriting those files.

  2. Copy the <KanziWorkspace>/Engine/applications/kzb_player/configs/platforms/android_gradle directory to the <ProjectName>/Application/configs/platforms directory of the Kanzi application that you want to migrate to the new Android platform package.

  3. In your Kanzi application, edit the Java resources:

    1. In the android_gradle/app/src/main/java/com/rightware/kanzi/kzbplayer directory rename the KZBPlayer.java file to the name of your application.

      For example, if your project is called MyProject, rename the KZBPlayer.java file to MyProject.java.

    2. In the android_gradle/app/src/main/java/com/rightware/kanzi directory rename the kzbplayer directory to the lowercase name of your application.

      For example, if your application is called MyProject, rename the kzbplayer directory to myproject.

    3. In a text editor open the <project_name>.java file and edit the file to include the references to your application.

      For example, if your application is called MyProject:

      • Change

        com.rightware.kanzi.kzbplayer

        to

        com.rightware.kanzi.myproject

      • Change the class

        KZBPlayer

        to

        MyProject

      • Change the TAG

        "KZBPlayer"

        to

        "MyProject"

      • Change

        Debug.startMethodTracing("kzbplayer")

        to

        Debug.startMethodTracing("myproject")

    4. In a text editor open the android_gradle/app/src/main/AndroidManifest.xml file and edit the file to include the references to your application.

      For example, if your application is called MyProject:

      • Change

        com.rightware.kanzi.kzbplayer

        to

        com.rightware.kanzi.myproject

      • Change

        activity android:name=".KZBPlayer"

        to

        activity android:name=".MyProject"

    5. In a text editor open the android_gradle/app/src/main/res/values/strings.xml file and edit the file to include the name of your application.

      For example, if your application is called MyProject, change

      <string name="app_name">KZB Player</string>

      to

      <string name="app_name">MyProject</string>

  4. In your project, edit the build scripts:

    1. In a text editor open the android_gradle/app/CMakeLists.txt file and edit the file to include the name of your application and the path to the C++ application source file.

      For example, if your application is called MyProject:

      • Change

        project(kzb_player)

        to

        project(myproject)

      • Change

        add_executable(${PROJECT_NAME} src/main/cpp/kzb_player.cpp)

        to

        add_executable(${PROJECT_NAME} ../../../../src/myproject.cpp)

    2. In a text editor open the android_gradle/settings.gradle file and edit the file to include the name of your application.

      For example, if your application is called MyProject, set the value of the rootProject.name to "myproject".

    3. In a text editor open the android_gradle/app/build.gradle file and edit the file so that applicationId points to you application.

      For example, if your application is called MyProject, set the applicationId to "com.rightware.kanzi.myproject".

    4. In a text editor open the android_gradle/gradle.properties file and replace:

      org.gradle.jvmargs=-Xmx<size>m
      

      with

      org.gradle.jvmargs=-Xmx4608m
      
  5. In your application, edit the C++ source files:

    1. In the Application/src/<project_name>.cpp file change:

      class <ProjectName>: public ExampleApplication
      

      to

      class <ProjectName>: public Application
      
    2. In the <project_name>.cpp file add a Module::registerMetadataOverride callback that does not contain V8Module registration:

      class <ProjectName>: public Application
      {
      public:
          ...
      
          void registerMetadataOverride(ObjectFactory& /*factory*/) override
          {
              Domain* domain = getDomain();
              KanziComponentsModule::registerModule(domain);
          }
      };
      
    3. In the <project_name>.cpp file in the Application::onConfigure callback function remove references to the ExampleApplication class:

      void onConfigure(ApplicationProperties& configuration) override
      {
          Application::onConfigure(configuration);
          configuration.binaryName = "<project_name>.kzb.cfg";
          configuration.extensionOutputEnabled = true;
          configuration.defaultSurfaceProperties.antiAliasing = 0;
          configuration.defaultSurfaceProperties.bitsDepthBuffer = 0;
          configuration.defaultSurfaceProperties.bitsStencil = 0;
      }
      
  6. Build and deploy your Kanzi application using either Android Studio or the command line interface. See Building and deploying Kanzi applications from Android Studio and Building and deploying Kanzi applications from the command line.

See also

Kanzi 3.6.6 release notes

Known issues