Qt World Summit: Register Today!

How to avoid my AndroidManifest.xml to be overwritten.

  • Hi everyone,
    For some features, as locking the screen rotation, it's necessary to change the AndroidManifest.xml.
    The problem is that if I modify it, once I compile my project again to load it to an Android Device, the AndroidManifest.xml device is overwritten.
    Has anyone know how to solve this problem?


  • Hi,
    You can put a config for Android in file .pro
    ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android-sources
    "android-sources" is folder contain AndroidManifest.xml

    For more detail, you can refer to : http://doc.qt.io/qt-5/deployment-android.html

  • Within Qt Creator

    • On the 'Mode Selector' pane select 'Projects'.
    • Under 'Build & Run', expand 'Build Android APK' by selecting details.
    • Under 'Android', click the 'Create Template' button.

    That will add an Android folder within your project folder with an AndroidManifest.xml file that you can edit and it will not be overwritten with each build.

Log in to reply