Android 12 build error

I getting this error when I try to build for android 12, api 31, <engine name="android" spec="10.1.1" />

UserError: FAILURE: Build failed with an exception. 
* What went wrong: Execution failed for task ':app:processReleaseMainManifest'. 
> Manifest merger failed : Apps targeting Android 12 and higher are required to specify an explicit value for `android:exported` when the corresponding component has an intent filter defined. 
See for details. 
See log for full details.

So I added android:exported="false" and android:exported="true" in my config below, and it still give me the same error. Voltbuilder and cordova don’t support android 12 yet?

<edit-config file="AndroidManifest.xml" target="/manifest/application/activity[@android:name='MainActivity']" mode="overwrite">
    <activity android:name="MainActivity" android:exported="true" android:label="myappname" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale"  android:launchMode="singleInstance"  android:alwaysRetainTaskState="false" android:windowSoftInputMode="adjustResize">  <intent-filter android:label="@string/launcher_name">
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />

A similar issue appeared this morning on the Cordova forums. We’re watching this closely.

Did you see this topic on StackOverflow? Looks like a lot of people have run into this.

Did that StackOverflow article help?

No, I created a new hello world app with no plugin to test it. i added

<engine name=android spec=10.1.1 
<preference name=android-minSdkVersion value=28
<preference name=android-targetSdkVersion value=31

in config.xml
it still give me the same error, I think the problem is

<edit-config file="AndroidManifest.xml" target="/manifest/application/activity[@android:name='MainActivity']" mode="overwrite">
    activity android:name="MainActivity" android:exported="false" android:label="myappname"/>

no longer work. I think I can’t add android:exported=“false or true” into the androidmanifest.xml because of the new change. I think the path to AndroidManifest.xml have changed in api 31, I tried different path that I found in the internet (app/src/main/AndroidManifest.xml), it still doesn’t work. You should try it with the correct path and see if you can add android:exported=“false or true”

Tip : If you’re pasting code, html or config files, surround the code with triple back ticks (```), before the first line and after the last one. It will be formatted properly. (We fixed it for you this time)

This is especially important when you are giving config file data, so the < tags do not disappear.

You need to put the ``` on a separate line.

(I fixed it for you)

Cool thanks! is

<edit-config file="AndroidManifest.xml" target="/manifest/application/activity[@android:name='MainActivity']" mode="overwrite">
    <activity android:name="MainActivity"  android:label="myappname"/>

still the correct way of writing to Androidmanfest.xml? is the path still correct?

edit-config is not processed by VoltBuilder - it just passes it through to Cordova. The Cordova docs are what you need to check here.

It looks like this issue could be resolved by cordova-android 10.1.2, which has not been released yet.