[SOLVED] Flutter : AAPT: error: unexpected element <queries> found in <manifest>.

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 was introduced <queries> as a manifest element, and older versions of the Android Gradle Plugin do not know about that element.

PROBLEM

Launching lib\main.dart on sdk gphone x86 in debug mode...
Parameter format not correct -

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
   > Android resource linking failed
     C:\Users\MyUserName\.gradle\daemon\6.5\Apps\my\app-android\build\flutter_inappwebview\intermediates\library_manifest\debug\AndroidManifest.xml:7:5-11:15: AAPT: error: unexpected element <queries> found in <manifest>.


* 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 41s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)

SOLUTION

I had this issue in flutter but I believe this solution will work for both flutter and native android dev.

Follow these steps

Step 1. Read this short blog to get some understanding: click here

Step 2. Delete the .gradle folder inside the android folder i.e., android / .gradle.

Step 3. See the above image from the step1 blog and upgrade the classpath in the android/build.gradle file. I’ve upgraded from classpath ‘com.android.tools.build:gradle:3.5.0’ to classpath ‘com.android.tools.build:gradle:3.5.4’ with the help of the above image.

Step 4. You can invalidate caches and restart your android studio. Make sure you have a good internet connection because it will download the new Gradle files or just run flutter clean and flutter pub get and run your project.

Note:- if your error is not solved then look at this thread once, Source: StackOverflow.

After following the above 4 Steps, my error is gone but after running the project, I found a new error i.e., Duplicate class com.google.common.util.concurrent.ListenableFuture found in modules guava-20.0.jar , have a look if you found it too.

That’s all.

I hope it fixed your Error.

Keep Coding.