How to Fix "Unexpected Element <Queries> Found in <Manifest>" Error

How can I fix unexpected element queries found in manifest error?

The Android Gradle Plugin needs to know about new manifest elements, particularly
for the manifest merger process. The plugin has a tendency to get confused if it
sees elements in the manifest merger that it does not recognize, tossing out
build errors like the one in the question.

In this case, Android 11 introduced <queries> as a manifest element, and older versions of the Android Gradle Plugin do not know about that element.

The fact that this occurs from manifest merger means that simply upgrading a dependency
might bring about this error. For example, if you upgrade to the latest
version of com.awesome:awesome-library, and it contained a <queries> element
in its manifest, you might crash with the aforementioned error in your builds,
even without any other changes in your code.

Google released a series of patch versions of the Android Gradle Plugin to address this:

  • 3.3.3
  • 3.4.3
  • 3.5.4
  • 3.6.4
  • 4.0.1

If you are using an existing plugin in the 3.3.* through 4.0.* series, upgrade
to the associated patch version (or higher) from that list, and you should no longer
run into that error (e.g., classpath 'com.android.tools.build:gradle:4.0.1').

If you are using Android Studio 4.1 or higher, with a matching
Android Gradle Plugin (e.g., in the 4.1.* series), you should be fine without
any changes. Those plugin versions were already aware of <queries>.

See this Android Developers Blog post for more.

I the error unexpected element queries found in manifest , how to fix it?

I also had same issue on Android Studio 4.1.1, suddenly, 2 days ago.
I solved the issue by upgrading build gradle version.

  • previous setting in build.gradle file of project was:
    classpath("com.android.tools.build:gradle:3.5.3")
  • current setting:
    classpath("com.android.tools.build:gradle:3.5.4")

The issue was gone immediately. :)

File picker : unexpected element queries found in manifest

found the solution here

Build is failing with unexpected element found in .

Possible solution:
This is because tag was introduced with new package visibility options for Android 11 and upwards (SDK 30+). Because of that, you need to update your build.gradle with a version that includes this changes. Below is a list of supported gradle options.

3.3.3

3.4.3

3.5.4

3.6.4

4.0.1
Don't forget to update your ditributionUrl in your gradle-wrapper.properties as well. For example, for gradle 4.0.1, you should have:

distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip

Exception thrown in build by image_picker

This is because tag was introduced with new package visibility options for Android 11 and upwards (SDK 30+). Because of that, you need to update your build.gradle with a version that includes this changes. Below is a list of supported gradle options.

'3.3.3', '3.4.3', '3.5.4', '3.6.4', '4.0.1'

Don't forget to update your ditributionUrl in your gradle-wrapper.properties as well. For example, for gradle 4.0.1, you should have:

distributionUrl=https://services.gradle.org/distributions/gradle-6.1.1-all.zip

reference: https://github.com/miguelpruivo/flutter_file_picker/wiki/Troubleshooting#android

Manifest Merger failed with multiple errors in Android Studio

Open application manifest (AndroidManifest.xml) and click on Merged Manifest tab on bottom of your edit pane. Check the image below:

Sample Image

From image you can see Error in the right column, try to solve the error. It may help some one with the same problem. Read more here.

Also, once you found the error and if you get that error from external library that you are using, You have to let compiler to ignore the attribute from the external library.
//add this attribute in application tag in the manifest

   tools:replace="android:allowBackup" 

//Add this in the manifest tag at the top

xmlns:tools="http://schemas.android.com/tools"


Related Topics



Leave a reply



Submit