[Interest] QML Plugin with Java (Android)
Brian Dentino
brian.dentino at gmail.com
Tue Sep 16 18:30:34 CEST 2014
I am trying to write a QML plugin that will work on both iOS and Android. The iOS implementation requires a mix of C++ & Objective C on the backend, while the Android implementation requires some C++ & Java. I struggled yesterday with figuring out the best way to deploy this Java alongside an application/project that wants to use this plugin on Android.
For now, I've settled on the following method, but I don't believe it's ideal because I had to modify the androiddeployqt tool to get what I want and it requires a developer to follow some implicit naming conventions when creating jars:
1. Compiling the plugin java to a .jar (bundled and non-bundled versions, as with QtAndroidBearer) when building the plugin.
2. Installing the plugin (.so and .jar) post-build to the [QT_INSTALL_PREFIX]/qml directory (alongside the built-in qml plugins).
3. Modifying a few lines of code in the androiddeployqt tool to detect .jar files when scanning qml imports and package these .jars in the /lib folder of the dependent application. Checks for a '-bundled.jar' suffix if the deployment method is 'bundled'.
Is anyone aware of a better/easier way to do this? It seems that the only built-in way to specify jar dependencies for deployment is by creating a new Qt module, which seems overkill for this plugin I'm working on. And from what I can tell, ANDROID_PACKAGE_SOURCE_DIR is intended more for use with individual standalone applications, not qml plugins.
Brian
More information about the Interest
mailing list