How to set icon for Qt Android app in CMake?
- 
So you put your Androïd related changes in the else clause that concerns Qt 5. 
- 
Move your changes to the Qt 6 part of the if. 
- 
Remember to do a full rebuild (clean, run cmake, rebuild) when you change cmake code. 
- 
I just yesterday figured this out for my app. - I use QT_ANDROID_PACKAGE_SOURCE_DIR instead.
 See the full CMake snippet here;
 set_target_properties(pay_mobile PROPERTIES QT_ANDROID_PACKAGE_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/android )- 
The XML file is in my subdir 'android' (as the above shows). It includes the property android:icon="@drawable/icon"
 Example here.
- 
In that same 'android' directory there is a `res/drawable' set of directories which contain the icons with the 'icon' base for the filename. Both of those you can see reflected in the above point. link. 
 Hope that helps! 
- I use QT_ANDROID_PACKAGE_SOURCE_DIR instead.
- 
I just yesterday figured this out for my app. - I use QT_ANDROID_PACKAGE_SOURCE_DIR instead.
 See the full CMake snippet here;
 set_target_properties(pay_mobile PROPERTIES QT_ANDROID_PACKAGE_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/android )- 
The XML file is in my subdir 'android' (as the above shows). It includes the property android:icon="@drawable/icon"
 Example here.
- 
In that same 'android' directory there is a `res/drawable' set of directories which contain the icons with the 'icon' base for the filename. Both of those you can see reflected in the above point. link. 
 Hope that helps! @TomZ Thank you ! 
 Adding this solved the issue ! Now everything works like a charm.if (ANDROID) set_target_properties(${PROJECT_NAME} PROPERTIES QT_ANDROID_PACKAGE_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/android ) qt6_android_generate_deployment_settings(${PROJECT_NAME}) qt_android_add_apk_target(${PROJECT_NAME}) endif ()
- I use QT_ANDROID_PACKAGE_SOURCE_DIR instead.
- 
@TomZ Thank you ! 
 Adding this solved the issue ! Now everything works like a charm.if (ANDROID) set_target_properties(${PROJECT_NAME} PROPERTIES QT_ANDROID_PACKAGE_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/android ) qt6_android_generate_deployment_settings(${PROJECT_NAME}) qt_android_add_apk_target(${PROJECT_NAME}) endif ()@Fest I would honestly love to understand how you came up with that. I'm still too new to understand what's going on in CMakeLists. 
 






