Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Could not get androiddeployqt to package/copy my subproject qml plugins / modules
Forum Updated to NodeBB v4.3 + New Features

Could not get androiddeployqt to package/copy my subproject qml plugins / modules

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
4 Posts 2 Posters 282 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jeremias.Bosch
    wrote on last edited by
    #1

    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/pluginB

    app adds an application using qt_add_executable, qt_add_qml_module
    pluginA adds a plugin module using

    qt_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 and build/pluginB.

    While, of course, I could add some POST_BUILD Commands to copy the libs to the app/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

    1 Reply Last reply
    1
    • J Offline
      J Offline
      Jeremias.Bosch
      wrote on last edited by
      #2

      Adding the Plugin Output directories to \app\android-....-deployment-settings.json into qml-import-paths resolves the Warning: 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?

      1 Reply Last reply
      1
      • KH-219DesignK Offline
        KH-219DesignK Offline
        KH-219Design
        wrote on last edited by
        #3

        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 my QT_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 either QT_ANDROID_PACKAGE_SOURCE_DIR or some similar cmake target setting?

        www.219design.com
        Software | Electrical | Mechanical | Product Design

        1 Reply Last reply
        0
        • KH-219DesignK Offline
          KH-219DesignK Offline
          KH-219Design
          wrote on last edited by
          #4

          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.

          Example: https://github.com/219-design/qt-qml-project-template-with-ci/blob/a85e7f49a127eab/src/app/imports.qml

          www.219design.com
          Software | Electrical | Mechanical | Product Design

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved