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
Forum Updated to NodeBB v4.3 + New Features

AndroidManifest.xml is not respected for Android project

Scheduled Pinned Locked Moved Solved Mobile and Embedded
5 Posts 3 Posters 496 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 17 Jan 2024, 01:38 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.

    E 1 Reply Last reply 17 Jan 2024, 13:05
    0
    • T Offline
      T Offline
      TomZ
      wrote on 17 Jan 2024, 15:59 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.

      E 1 Reply Last reply 17 Jan 2024, 17:03
      0
      • S swurl
        17 Jan 2024, 01:38

        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.

        E Offline
        E Offline
        ekkescorner
        Qt Champions 2016
        wrote on 17 Jan 2024, 13:05 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.8 https://t1p.de/ekkeChecklist
        QMake --> CMake https://t1p.de/ekkeCMakeMobileApps

        1 Reply Last reply
        0
        • T Offline
          T Offline
          TomZ
          wrote on 17 Jan 2024, 15:59 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.

          E 1 Reply Last reply 17 Jan 2024, 17:03
          0
          • T TomZ
            17 Jan 2024, 15:59

            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.

            E Offline
            E Offline
            ekkescorner
            Qt Champions 2016
            wrote on 17 Jan 2024, 17:03 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.8 https://t1p.de/ekkeChecklist
            QMake --> CMake https://t1p.de/ekkeCMakeMobileApps

            T 1 Reply Last reply 18 Jan 2024, 13:45
            1
            • E ekkescorner
              17 Jan 2024, 17:03

              @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

              T Offline
              T Offline
              TomZ
              wrote on 18 Jan 2024, 13:45 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
              • T TomZ referenced this topic on 18 Jan 2024, 14:05
              • S swurl has marked this topic as solved on 6 Feb 2024, 16:07

              1/5

              17 Jan 2024, 01:38

              • Login

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