AndroidManifest.xml is not respected for Android project
-
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. -
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.
-
@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_DIRhere's noted that variables are valid for qmake and cmake:
https://doc.qt.io/qt-6/android-deploy-qt-tool.html#android-specific-qmake-variablesperhaps try ANDROID_PACKAGE_SOURCE_DIR
have seen cmake examples, where both variables are used -
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.
-
@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 -
@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. -
-