Solved How to set icon for Qt Android app in CMake?
-
I have created Android App successfully. But when i am deploying the app, the icon set as default. How can i change the default icon to custom in CMake?
-
@TomZ Thank you !!!
Added below line. This solved my issue. -
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.
-
I have gone through the steps mentioned in that link. Could not get the expected result. Please guide me ...
-
What exactly did you do ?
-
@SGaist Please see steps below.
- Created Qt android project in CMake and build in release mode.
- Created a folder named "android" in project folder (Where CMakeLists.txt file exist)
- Copied "AndroidManifest.xml" from "android-build" folder and paste it to "android" folder which already created in step 2.
- Open Projects option Qt , and under "Build Android APK" option selected "Create Templates" and edited "AndroidManifest.xml" (Added icon)
- Build again and deployed. The icon not updated.!
Please see my edited "AndroidManifest.xml" file below.
Capture.PNG -
Check the xml file in the build folder to see if it has changed. If not, delete the build folder and start anew.
-
@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.
-
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.
-
@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?
-
Did you already do what is described here ?
-
@SGaist Yes i did it in the way. But no result. Please see my attached screenshot.
-
Which version of Qt are you using ?
-
@SGaist Latest one.
-
That's Qt Creator. I am asking which version you use to build your application.
-
@SGaist This one.
-
So you put your Androïd related changes in the else clause that concerns Qt 5.
-
@SGaist What to do? please guide me.
-
Move your changes to the Qt 6 part of the if.
-
@SGaist Done as mentioned. But there is no change found. Please see screenshot.
-
Remember to do a full rebuild (clean, run cmake, rebuild) when you change cmake code.