Could not get androiddeployqt to package/copy my subproject qml plugins / modules
-
Hey,
;Short; The APK is generated, but its missing the libs of my plugins
;Long;
I have some complex CMAKE project at hand which has some trouble with androiddeployqt. I'm using Qt6.5 on Windows.The layout looks like this (much more projects, but thats the core)
/root/
/root/app
/root/import/pluginA
/root/import/pluginBapp adds an application using
qt_add_executable
,qt_add_qml_module
pluginA adds a plugin module usingqt_add_qml_module(${PROJECT_NAME} URI pluginA.uri VERSION 1.0 PLUGIN_TARGET ${PROJECT_NAME} NO_GENERATE_PLUGIN_SOURCE NO_PLUGIN_OPTIONAL QML_FILES ...)
pluginB adds a plugin module using
qt_add_qml_module(${PROJECT_NAME} URI pluginB.uri VERSION 1.0 PLUGIN_TARGET ${PROJECT_NAME} NO_GENERATE_PLUGIN_SOURCE NO_PLUGIN_OPTIONAL QML_FILES ...)
When I build for android I get a
build/app/android-build/libs/.xx./
folder containing all the libs from app.The Plugins are build in their directories
build/pluginA
andbuild/pluginB
.While, of course, I could add some
POST_BUILD
Commands to copy the libs to theapp/android-build/..
folder I would have guessed that this should just work as part of using qt_add... functions.One suspicious part on the build log is this:
Warning: QML import could not be resolved in any of the import paths: pluginA.uri Warning: QML import could not be resolved in any of the import paths: pluginB.uri
While this might be nothing than noise, I'm not sure if this is the reason - in any case, does anyone know how to get rid of this output?
One interessting part is that the generated
\app\android-....-deployment-settings.json
contains the build pathes of pluginA and pluginB in extraLibraryDirs., but nothing more.Does anyone have this working and can confirm my assumption that this 'should' work?
Thanks & Best, Jeremias -
Adding the Plugin Output directories to
\app\android-....-deployment-settings.json
intoqml-import-paths
resolves theWarning: QML import could not be resolved in any of the import paths: pluginA/B.uri
and ensures that the modules are copied correctly... but how can I add those pathes automatically to the settings file during the cmake build? -
My answer is probably not the full solution. But at least maybe by keeping this thread active it might land on the radar of more commenters.
I build on Linux, but I think that whatever the "qt cmake way" to make Android things work should hold up using cmake on either Linux or Windows.
For my target, I have a cmake clause like so:
set_target_properties( MyAppTargetName PROPERTIES BUILD_RPATH_USE_ORIGIN TRUE QT_ANDROID_PACKAGE_SOURCE_DIR ${CMAKE_SOURCE_DIR}/src/lib/android QT_ANDROID_ABIS "armeabi-v7a;arm64-v8a;x86;x86_64" QT_ANDROID_BUILD_ALL_ABIS ON QT_ANDROID_TARGET_SDK_VERSION 33 )
and in the folder
${CMAKE_SOURCE_DIR}/src/lib/android
(which you see is the value of myQT_ANDROID_PACKAGE_SOURCE_DIR
), I have the following files:src/lib/android/AndroidManifest.xml src/lib/android/build.gradle src/lib/android/gradle.properties
And my copies of those files are (somehow, due to CMake) used during the build to override the defaults for them that Qt would otherwise create.
so....
... I'm guessing (just a guess at this point) that you can perhaps place your own
deployment-settings.json
in a similar spot and specify it via eitherQT_ANDROID_PACKAGE_SOURCE_DIR
or some similar cmake target setting? -
This next part is a tangent, but I mention it because you might run into this next:
You may also need to use a kind of "dummy imports qml" file later, to make sure that the deployed app contains all the Qt framework QML that you expect.