Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved Cross-compile application for Android and generate apk from command line

    Mobile and Embedded
    1
    2
    162
    Loading More Posts
    • 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.
    • C
      cristeab last edited by

      Hi
      I am trying to cross-compile an apk for Android on macOS using Qt5.15.2 with cmake.
      While Android NDK has support for cross-compiling with cmake, androiddeployqt is not able to generate correctly the apk file. The custom target used to generate the apk is shown below:

      add_custom_target(pack COMMAND ${androiddeployqt_ROOT_PATH}/bin/androiddeployqt
                 --input android_deployment_settings.json
                 --output ${CMAKE_BINARY_DIR}/android-build
                 --android-platform android-21
                 --gradle
                 --release
                 --sign ${STORE_FILENAME} ${STORE_USERNAME}
                 --storepass ${STORE_PASSWORD})
      

      But it exists with error because it cannot find zipalign.

      I was able to generate the apk, after changing this file
      ~/Qt/5.15.2/android/lib/cmake/Qt5Core/Qt5AndroidSupport.cmake
      such that sdkBuildToolsRevision is defined as
      "sdkBuildToolsRevision": "21.1.1",
      In this way zipalign is found by androiddeployqt.

      However, I still need to configure AndroidManifest.xml.
      So my question is how can I specify a custom AndroidManifest.xml file to be used by androiddeployqt ? Previously, with qmake, there was a way to specify a folder where AndroidManifest.xml could be put, ANDROID_PACKAGE_SOURCE_DIR, but I don't know how to do the same in cmake.

      thank you
      Bogdan

      1 Reply Last reply Reply Quote 1
      • C
        cristeab last edited by

        I have created a bug report here: https://bugreports.qt.io/browse/QTBUG-93372

        1 Reply Last reply Reply Quote 0
        • First post
          Last post