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. AndroidManifest.xml is not respected for Android project

AndroidManifest.xml is not respected for Android project

Scheduled Pinned Locked Moved Solved Mobile and Embedded
5 Posts 3 Posters 760 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.
  • S Offline
    S Offline
    swurl
    wrote on last edited by
    #1

    I've added an AndroidManifest.xml file to my project with:

        set(QT_ANDROID_PACKAGE_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/android)
    

    However, when running the built APK, it doesn't respect the icons or app name I set. The app name is simply org.qtproject.example.ProjectName, when I set it to e.g. org.awesome.ProjectName, and it uses the default Android app icon.

    ekkescornerE 1 Reply Last reply
    0
    • TomZT Offline
      TomZT Offline
      TomZ
      wrote on last edited by
      #3

      Here is an example:
      CMake:

      set_target_properties(pay_mobile PROPERTIES
             QT_ANDROID_PACKAGE_SOURCE_DIR ${CMAKE_SOURCE_DIR}/android
             COMPILE_DEFINITIONS "${COMPILE_DEFINITIONS} MOBILE"
      

      And the android dir has the AndroidManifest.xml. Notice that the 'res' dir is a subdir of the 'android' dir.

      ekkescornerE 1 Reply Last reply
      0
      • S swurl

        I've added an AndroidManifest.xml file to my project with:

            set(QT_ANDROID_PACKAGE_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/android)
        

        However, when running the built APK, it doesn't respect the icons or app name I set. The app name is simply org.qtproject.example.ProjectName, when I set it to e.g. org.awesome.ProjectName, and it uses the default Android app icon.

        ekkescornerE Offline
        ekkescornerE Offline
        ekkescorner
        Qt Champions 2016
        wrote on last edited by ekkescorner
        #2

        @swurl curious:
        https://doc.qt.io/qt-6/qmake-variable-reference.html#android-package-source-dir uses
        ANDROID_PACKAGE_SOURCE_DIR
        https://doc.qt.io/qt-6/cmake-target-properties-qtcore.html uses
        QT_ANDROID_PACKAGE_SOURCE_DIR

        here's noted that variables are valid for qmake and cmake:
        https://doc.qt.io/qt-6/android-deploy-qt-tool.html#android-specific-qmake-variables

        perhaps try ANDROID_PACKAGE_SOURCE_DIR
        have seen cmake examples, where both variables are used

        ekke ... Qt Champion 2016 | 2024 ... mobile business apps
        5.15 --> 6.9 https://t1p.de/ekkeChecklist
        QMake --> CMake https://t1p.de/ekkeCMakeMobileApps

        1 Reply Last reply
        0
        • TomZT Offline
          TomZT Offline
          TomZ
          wrote on last edited by
          #3

          Here is an example:
          CMake:

          set_target_properties(pay_mobile PROPERTIES
                 QT_ANDROID_PACKAGE_SOURCE_DIR ${CMAKE_SOURCE_DIR}/android
                 COMPILE_DEFINITIONS "${COMPILE_DEFINITIONS} MOBILE"
          

          And the android dir has the AndroidManifest.xml. Notice that the 'res' dir is a subdir of the 'android' dir.

          ekkescornerE 1 Reply Last reply
          0
          • TomZT TomZ

            Here is an example:
            CMake:

            set_target_properties(pay_mobile PROPERTIES
                   QT_ANDROID_PACKAGE_SOURCE_DIR ${CMAKE_SOURCE_DIR}/android
                   COMPILE_DEFINITIONS "${COMPILE_DEFINITIONS} MOBILE"
            

            And the android dir has the AndroidManifest.xml. Notice that the 'res' dir is a subdir of the 'android' dir.

            ekkescornerE Offline
            ekkescornerE Offline
            ekkescorner
            Qt Champions 2016
            wrote on last edited by
            #4

            @TomZ you're right - it must be set_target_properties and not set.
            ...think COMPILE_DEFINITIONS isn't needed, if building/deploying from inside QtCreator ?

            ...first steps with CMake ;-)
            after porting my apps from 5.15 to 6.6 now it's time to port from QMake to CMake

            ekke ... Qt Champion 2016 | 2024 ... mobile business apps
            5.15 --> 6.9 https://t1p.de/ekkeChecklist
            QMake --> CMake https://t1p.de/ekkeCMakeMobileApps

            TomZT 1 Reply Last reply
            1
            • ekkescornerE ekkescorner

              @TomZ you're right - it must be set_target_properties and not set.
              ...think COMPILE_DEFINITIONS isn't needed, if building/deploying from inside QtCreator ?

              ...first steps with CMake ;-)
              after porting my apps from 5.15 to 6.6 now it's time to port from QMake to CMake

              TomZT Offline
              TomZT Offline
              TomZ
              wrote on last edited by
              #5

              @ekkescorner said in AndroidManifest.xml is not respected for Android project:

              ...think COMPILE_DEFINITIONS isn't needed, if building/deploying from inside QtCreator

              not needed, just an example.
              It adds a define to the compiler, which allows you to use #ifdef MOBILE in you code.

              1 Reply Last reply
              0
              • TomZT TomZ referenced this topic on
              • S swurl has marked this topic as solved on

              • Login

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