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. How to set icon for Qt Android app in CMake?

How to set icon for Qt Android app in CMake?

Scheduled Pinned Locked Moved Solved Mobile and Embedded
27 Posts 7 Posters 5.0k Views
  • 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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #2

    Hi,

    You need to create the template files like describe here and then edit the AndroidManifest.xml file to set the icon. If memory serves well, Qt Creator has an editor for that file that allows to do some of the setup through it rather than edit the file directly.

    Interested in AI ? www.idiap.ch
    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

    1 Reply Last reply
    0
    • AkshaiA Offline
      AkshaiA Offline
      Akshai
      wrote on last edited by
      #3

      I have gone through the steps mentioned in that link. Could not get the expected result. Please guide me ...

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #4

        What exactly did you do ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • AkshaiA Offline
          AkshaiA Offline
          Akshai
          wrote on last edited by Akshai
          #5

          @SGaist Please see steps below.

          1. Created Qt android project in CMake and build in release mode.
          2. Created a folder named "android" in project folder (Where CMakeLists.txt file exist)
          3. Copied "AndroidManifest.xml" from "android-build" folder and paste it to "android" folder which already created in step 2.
          4. Open Projects option Qt , and under "Build Android APK" option selected "Create Templates" and edited "AndroidManifest.xml" (Added icon)
          5. Build again and deployed. The icon not updated.!

          Please see my edited "AndroidManifest.xml" file below.
          Capture.PNG

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #6

            Check the xml file in the build folder to see if it has changed. If not, delete the build folder and start anew.

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            AkshaiA 1 Reply Last reply
            0
            • SGaistS SGaist

              Check the xml file in the build folder to see if it has changed. If not, delete the build folder and start anew.

              AkshaiA Offline
              AkshaiA Offline
              Akshai
              wrote on last edited by
              #7

              @SGaist I checked "AndroidManifest.xml" file in the build folder, it is not changed. "AndroidManifest.xml" file in the build folder will update everytime when we building. So if i modified the file, it will not reflect in the build apk.

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #8

                It's not that one that you have to change. It's the one you copied into your sources. It should then be used when building your application.

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                AkshaiA 1 Reply Last reply
                0
                • SGaistS SGaist

                  It's not that one that you have to change. It's the one you copied into your sources. It should then be used when building your application.

                  AkshaiA Offline
                  AkshaiA Offline
                  Akshai
                  wrote on last edited by
                  #9

                  @SGaist I could not set the modified "AndroidManifest.xml" path which should be used when building your application. How can i set through "CMakeLists.txt" file?

                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #10

                    Did you already do what is described here ?

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    AkshaiA 1 Reply Last reply
                    0
                    • SGaistS SGaist

                      Did you already do what is described here ?

                      AkshaiA Offline
                      AkshaiA Offline
                      Akshai
                      wrote on last edited by
                      #11

                      @SGaist Yes i did it in the way. But no result. Please see my attached screenshot. Qt_Forum_Question_Details.png

                      1 Reply Last reply
                      0
                      • SGaistS Offline
                        SGaistS Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on last edited by
                        #12

                        Which version of Qt are you using ?

                        Interested in AI ? www.idiap.ch
                        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                        AkshaiA 1 Reply Last reply
                        0
                        • SGaistS SGaist

                          Which version of Qt are you using ?

                          AkshaiA Offline
                          AkshaiA Offline
                          Akshai
                          wrote on last edited by
                          #13

                          @SGaist Latest one.Capture.PNG

                          1 Reply Last reply
                          0
                          • SGaistS Offline
                            SGaistS Offline
                            SGaist
                            Lifetime Qt Champion
                            wrote on last edited by
                            #14

                            That's Qt Creator. I am asking which version you use to build your application.

                            Interested in AI ? www.idiap.ch
                            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                            AkshaiA 1 Reply Last reply
                            0
                            • SGaistS SGaist

                              That's Qt Creator. I am asking which version you use to build your application.

                              AkshaiA Offline
                              AkshaiA Offline
                              Akshai
                              wrote on last edited by
                              #15

                              @SGaist This one.aaa.png

                              1 Reply Last reply
                              0
                              • SGaistS Offline
                                SGaistS Offline
                                SGaist
                                Lifetime Qt Champion
                                wrote on last edited by
                                #16

                                So you put your Androïd related changes in the else clause that concerns Qt 5.

                                Interested in AI ? www.idiap.ch
                                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                AkshaiA 1 Reply Last reply
                                0
                                • SGaistS SGaist

                                  So you put your Androïd related changes in the else clause that concerns Qt 5.

                                  AkshaiA Offline
                                  AkshaiA Offline
                                  Akshai
                                  wrote on last edited by
                                  #17

                                  @SGaist What to do? please guide me.

                                  1 Reply Last reply
                                  0
                                  • SGaistS Offline
                                    SGaistS Offline
                                    SGaist
                                    Lifetime Qt Champion
                                    wrote on last edited by
                                    #18

                                    Move your changes to the Qt 6 part of the if.

                                    Interested in AI ? www.idiap.ch
                                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                    AkshaiA 1 Reply Last reply
                                    0
                                    • SGaistS SGaist

                                      Move your changes to the Qt 6 part of the if.

                                      AkshaiA Offline
                                      AkshaiA Offline
                                      Akshai
                                      wrote on last edited by
                                      #19

                                      @SGaist Done as mentioned. But there is no change found. Please see screenshot.aaa.png

                                      J.HilkJ 1 Reply Last reply
                                      0
                                      • sierdzioS Offline
                                        sierdzioS Offline
                                        sierdzio
                                        Moderators
                                        wrote on last edited by
                                        #20

                                        Remember to do a full rebuild (clean, run cmake, rebuild) when you change cmake code.

                                        (Z(:^

                                        AkshaiA 1 Reply Last reply
                                        0
                                        • AkshaiA Akshai

                                          @SGaist Done as mentioned. But there is no change found. Please see screenshot.aaa.png

                                          J.HilkJ Offline
                                          J.HilkJ Offline
                                          J.Hilk
                                          Moderators
                                          wrote on last edited by
                                          #21

                                          @Akshai also, delete the app from your device, let it install fresh


                                          Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                                          Q: What's that?
                                          A: It's blue light.
                                          Q: What does it do?
                                          A: It turns blue.

                                          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