AndroidManifest.xml resets on each run

The topic is for Capacitor 3, Ionic 6, Vue 3

Each time I start my app locally, the AndroidManifest.xml is reset quite aggressively. I.e. lots of the XML is removed, formatted, etc. Is there a way I can instruct capacitor to leave the manifest as-is?

I run the app this way: ionic capacitor run android -l --external

The AndroidManifest.xml change I have to redo each time is to allow android:usesCleartextTraffic so I can debug, like this:

    <application
        android:usesCleartextTraffic="true"

dependencies:

    "@capacitor/android": "3.3.3",
    "@capacitor/app": "1.0.7",
    "@capacitor/core": "3.3.3",
    "@ionic/vue": "^6.0.0",

devDependencies:

    "@capacitor/cli": "3.3.3",
    "@vue/cli-service": "~5.0.0-rc.1",

Do you have AndroidManifest.xml.orig file in the same directory?

Yes, the original manifest becomes AndroidManifest.xml.orig in the same directory. What does that signify? Is there a way to prevent or modify this behavior?

I am also not having idea of that. But a work around is to copy AndroidManifest.xml.orig to AndroidManifest.xml and rebuild the app.

You should be able to set server.cleartext to true in the Capacitor config and that will properly modify your AndroidManifest.xml: Capacitor - build cross platform apps with the web