Resolving Android Gradle Build Errors

How to resolve "AAPT: error: unexpected element <queries> found in <manifest>" error?

queries tag in Android Manifest is a requirement when you use Target API 30. To let gradle(Build system on Android) process the manifest files with queries tag, the project needs to atleast use 5.6.4+ gradle version. All Unity versions from 2020.x support 5.6.4+ gradle version. So, you don't see this error on those unity versions.
For supporting queries tag(which is required for Android 11 support/Target API 30), Gradle Version needs to be 5.6.4+. To assure this, your unity's Android Gradle Version needs to be atleast nearest of 3.3.3/3.4.3/3.5.4/3.6.4/4.0.1 versions.
You need to edit the Android Plugin Version to any of the closest in above versions.
Update Android Gradle Version to nearest of 3.3.3/3.4.3/3.5.4/4.0.1
Android Gradle Plugin Version and Gradle Version are two different values and not the same.
If you are latest versions, you may see "Custom Base Gradle Template" option. Just enable it in Player Settings and edit baseProjectTemplate file to include above version.
Copy link