Using Java/Kotlin with CMake Qt 6. How?
-
Hello all!
Trying to find examples or manuals or references for the case of mixing Java/Kotlin in Qt 6 project with CMake. Is there any? Is it possible to use Kotlin instead of Java with Qt 6?
@bogong
I know nothing about Java or Kotlin. However there is a QtJambi project which provides Java/Kotlin bindings for Qt, would looking at its sources or perhaps contacting its author help you here? The author posts regularly on this forum as each QtJambi version is released for each Qt release. Last post was: https://forum.qt.io/topic/163086/qtjambi-6.9.2-available -
Found this manual for using Java https://somcosoftware.com/en/blog/how-to-interface-qt-with-android-java-code-2023. Didn't tested it yet by my own.
Going to write my own example based on this manual. Will publish here link on it.
-
Official documentation https://doc.qt.io/qt-6/deployment-android.html
Briefly - you need to define QT_ANDROID_PACKAGE_SOURCE_DIR variable correctly, something like this in CMakeLists.txt:
if(ANDROID) set_property(TARGET ${A_NAME_APPLICATION} PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR "/full/path/to/Platforms/android") endif()
In which you need to create 'src' folder
-