'cordova android release failed in app:packageReleaseBundle

I can build my Ionic 5 app for Android (cordova build android) but I get the following error when I try to build it for a release (cordova build android --release)

I have removed and re-installed cordova-android 10.1.2 several time, and I am using gradle 6.7.1.

I would like to know what I should check more to fix that problem, thanks!

Thanks!

Subproject Path: CordovaLib
Subproject Path: app

> Configure project :app
+-----------------------------------------------------------------
| cordova-android-support-gradle-release: 27.+
+-----------------------------------------------------------------
WARNING:: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed in version 7.0 of the Android Gradle plugin.
For more information, see http://d.android.com/r/tools/update-dependency-configurations.html.
WARNING:: Using flatDir should be avoided because it doesn't support any meta-data formats.
WARNING:: Using flatDir2 should be avoided because it doesn't support any meta-data formats.

> Task :app:packageReleaseBundle FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:packageReleaseBundle'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.PackageBundleTask$BundleToolWorkAction
   > File 'root/AndroidManifest.xml' uses reserved file or directory name 'AndroidManifest.xml'.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 3s
52 actionable tasks: 10 executed, 42 up-to-date


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source