Troubleshooting Android application development with Kanzi¶
When you receive this error while building an Android package:
Make sure that you are using Android Studio version 4.1.3 or newer. This error occurs on Android Studio version 3.1.
When you receive this error while building an Android package:
Increase the available heap amount in the Gradle build system. For example, in Android Studio open the
<ProjectName>/Application/configs/platforms/android_gradle
project, in that project open thegradle.properties
file and set:When you receive this error while building an Android package:
In the
<ProjectName>/Application/configs/platforms/android_gradle
directory of your project create a file calledlocal.properties
and in that file set the correct location of your workspace. For example, set:When you receive this error while building an Android package:
Add the path to the CMake
bin
directory to your system path. You can find the CMakebin
directory in the Android SDK. For example,android-sdk/cmake/3.10.2.4988404/bin
.When you receive this warning while building an application that uses the Data_source_plugin_template:
More than one file was found with OS independent path 'lib/arm64-v8a/libkzcoreui.so'. This version of the Android Gradle Plugin chooses the file from the app or dynamic-feature module, but this can cause unexpected behavior or errors at runtime. Future versions of the Android Gradle Plugin will throw an error in this case
Update the Kanzi Gradle plugin to version 0.7.1.
When you receive this error when starting the Preview for a Kanzi Studio project that uses a Java Kanzi Engine plugin:
For the Kanzi Studio Preview to load a Java Kanzi Engine plugin, the Preview must find the
jvm.dll
from the local 64-bit JDK. Set either:PATH
environment variable to include the directory that contains thejvm.dll
from the 64-bit JDK. This can be either:The JDK that is bundled with Android Studio.
For example,
C:\Program Files\Android\Android Studio\jre\bin\server
.Your own OpenJDK installation.
For example,
<openjdk>\jre\bin\server
.
JAVA_HOME
environment variable to the 64-bit JDK path and include in the%JAVA_HOME%\bin\server
directory thejvm.dll
from the 64-bit JDK.
When you receive one of these exceptions when running your Android application:
E/AndroidRuntime: FATAL EXCEPTION: main Process: <process name>, PID: <pid> java.lang.NoSuchMethodError: No static method metafactory(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite; in class Ljava/lang/invoke/LambdaMetafactory; or its super classes (declaration of 'java.lang.invoke.LambdaMetafactory' appears in /apex/com.android.runtime/javalib/core-oj.jar) at com.rightware.kanzi.KanziViewAdapter.loadStartupPrefab(KanziViewAdapter.java:664) at com.rightware.kanzi.KanziViewAdapter.setStartupPrefabUrl(KanziViewAdapter.java:196)
Your application is most likely using an incompatible version of Java. Kanzi Android framework (droidfw) and Kanzi Java API require Java 8 (1.8).
In the
app/build.gradle
file of your Android Studio project, ensure that the Java language version is set to a compatible version:When using Android Studio to convert a Java project to Kotlin, the default generated gradle script uses the latest version of Kotlin by default. This can result in an error similar to:
Make sure that the version of Kotlin is compatible with your project. For example, if your project uses compileSdkVersion 28, downgrade Kotlin to version 1.6.0.
Replace
with
or