Gradle Build Failed. Android resource linking failed, after add package GoogleMobileAds-v6.0.2

Hello, I hope everyone is doing well, I have a problem right now, if anyone could help me that would be great.

So, I wanted to set up the Google AdMob service on one of my Unity projects.

Here is the version that I use with all the models present and to install.

7381397--900707--upload_2021-8-2_10-54-1.png

I have no compilation problem so far, everything is working fine.

But when I have to integrate the package “GoogleMobileAds-v6.0.2”.

Documentation Google AdMob Mobile Ads SDK

That must be installed as followed in the documentation and all the tutorial videos found on YouTube.

Before compiling I fill in the settings of Google Mobile SDK correctly, let’s not forget the keystore so that it also compiles.

So as soon as I get to this part of the compilation everything crashes, since there will be a compilation error.

7381397--900716--upload_2021-8-2_11-2-45.png

7381397--900719--upload_2021-8-2_11-4-20.png

Here are the compilation errors, I will list them in ascending order.

Starting a Gradle Daemon, 1 incompatible and 2 stopped Daemons could not be reused, use --status for details

Starting a Gradle Daemon, 1 incompatible and 2 stopped Daemons could not be reused, use --status for details
> Task :launcher:preBuild UP-TO-DATE
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:preBuild UP-TO-DATE
> Task :unityLibrary:preBuild UP-TO-DATE
> Task :unityLibrary:preReleaseBuild UP-TO-DATE
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:preReleaseBuild UP-TO-DATE
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:checkReleaseManifest
> Task :unityLibrary:checkReleaseManifest
> Task :launcher:prepareLintJar
> Task :unityLibrary:processReleaseManifest
> Task :unityLibrary:packageReleaseRenderscript NO-SOURCE
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:processReleaseManifest
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:compileReleaseAidl NO-SOURCE
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:packageReleaseRenderscript NO-SOURCE
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:compileReleaseRenderscript NO-SOURCE
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:generateReleaseResValues
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:generateReleaseResources
> Task :unityLibrary:generateReleaseBuildConfig
> Task :unityLibrary:compileReleaseAidl NO-SOURCE
> Task :unityLibrary:compileReleaseRenderscript NO-SOURCE
> Task :unityLibrary:generateReleaseResValues
> Task :unityLibrary:generateReleaseResources
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:packageReleaseResources
> Task :unityLibrary:packageReleaseResources
> Task :unityLibrary:prepareLintJar
> Task :unityLibrary:generateReleaseSources
> Task :unityLibrary:prepareLintJarForPublish
> Task :unityLibrary:mergeReleaseShaders
> Task :unityLibrary:compileReleaseShaders
> Task :unityLibrary:generateReleaseAssets
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:generateReleaseRFile
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:generateReleaseBuildConfig
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:prepareLintJar
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:generateReleaseSources
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:javaPreCompileRelease
> Task :unityLibrary:packageReleaseAssets
> Task :launcher:preReleaseBuild
> Task :launcher:compileReleaseAidl NO-SOURCE
> Task :launcher:compileReleaseRenderscript NO-SOURCE
> Task :launcher:checkReleaseManifest
> Task :launcher:generateReleaseBuildConfig
> Task :launcher:generateReleaseSources
> Task :launcher:mainApkListPersistenceRelease
> Task :launcher:generateReleaseResValues
> Task :launcher:generateReleaseResources
> Task :unityLibrary:generateReleaseRFile
> Task :unityLibrary:processReleaseJavaRes NO-SOURCE
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:compileReleaseJavaWithJavac
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:bundleLibCompileRelease
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:prepareLintJarForPublish
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:mergeReleaseShaders
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:compileReleaseShaders
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:generateReleaseAssets
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:packageReleaseAssets
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:bundleLibRuntimeRelease
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:processReleaseJavaRes NO-SOURCE
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:bundleLibResRelease
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:mergeReleaseJniLibFolders
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:transformNativeLibsWithMergeJniLibsForRelease
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:transformNativeLibsWithStripDebugSymbolForRelease
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:transformNativeLibsWithIntermediateJniLibsForRelease
> Task :unityLibrary:mergeReleaseJniLibFolders
> Task :launcher:mergeReleaseResources
> Task :launcher:createReleaseCompatibleScreenManifests
> Task :unityLibrary:javaPreCompileRelease
> Task :launcher:processReleaseManifest
> Task :launcher:processReleaseResources FAILED

> Task :unityLibrary:compileReleaseJavaWithJavac

Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.1.1/userguide/command_line_interface.html#sec:command_line_warnings
44 actionable tasks: 44 executed

UnityEngine.GUIUtility:ProcessEvent (int,intptr)

Note: D:\Projet Unity\Missile Command\Temp\gradleOut\unityLibrary\src\main\java\com\unity3d\player\UnityPlayerActivity.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

Note: D:\Projet Unity\Missile Command\Temp\gradleOut\unityLibrary\src\main\java\com\unity3d\player\UnityPlayerActivity.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':launcher:processReleaseResources'.
> Android resource linking failed
  D:\Projet Unity\Missile Command\Temp\gradleOut\launcher\build\intermediates\merged_manifests\release\AndroidManifest.xml:38: 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 16s
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8

UnityEngine.GUIUtility:ProcessEvent (int,intptr)

CommandInvokationFailure: Gradle build failed.

CommandInvokationFailure: Gradle build failed.
D:/Programmes/2019.4.22f1/Editor/Data/PlaybackEngines/AndroidPlayer\OpenJDK\bin\java.exe -classpath "D:\Programmes\2019.4.22f1\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-5.1.1.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "assembleRelease"

stderr[
Note: D:\Projet Unity\Missile Command\Temp\gradleOut\unityLibrary\src\main\java\com\unity3d\player\UnityPlayerActivity.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':launcher:processReleaseResources'.
> Android resource linking failed
  D:\Projet Unity\Missile Command\Temp\gradleOut\launcher\build\intermediates\merged_manifests\release\AndroidManifest.xml:38: 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 16s
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
]
stdout[
Starting a Gradle Daemon, 1 incompatible and 2 stopped Daemons could not be reused, use --status for details
> Task :launcher:preBuild UP-TO-DATE
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:preBuild UP-TO-DATE
> Task :unityLibrary:preBuild UP-TO-DATE
> Task :unityLibrary:preReleaseBuild UP-TO-DATE
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:preReleaseBuild UP-TO-DATE
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:checkReleaseManifest
> Task :unityLibrary:checkReleaseManifest
> Task :launcher:prepareLintJar
> Task :unityLibrary:processReleaseManifest
> Task :unityLibrary:packageReleaseRenderscript NO-SOURCE
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:processReleaseManifest
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:compileReleaseAidl NO-SOURCE
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:packageReleaseRenderscript NO-SOURCE
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:compileReleaseRenderscript NO-SOURCE
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:generateReleaseResValues
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:generateReleaseResources
> Task :unityLibrary:generateReleaseBuildConfig
> Task :unityLibrary:compileReleaseAidl NO-SOURCE
> Task :unityLibrary:compileReleaseRenderscript NO-SOURCE
> Task :unityLibrary:generateReleaseResValues
> Task :unityLibrary:generateReleaseResources
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:packageReleaseResources
> Task :unityLibrary:packageReleaseResources
> Task :unityLibrary:prepareLintJar
> Task :unityLibrary:generateReleaseSources
> Task :unityLibrary:prepareLintJarForPublish
> Task :unityLibrary:mergeReleaseShaders
> Task :unityLibrary:compileReleaseShaders
> Task :unityLibrary:generateReleaseAssets
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:generateReleaseRFile
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:generateReleaseBuildConfig
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:prepareLintJar
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:generateReleaseSources
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:javaPreCompileRelease
> Task :unityLibrary:packageReleaseAssets
> Task :launcher:preReleaseBuild
> Task :launcher:compileReleaseAidl NO-SOURCE
> Task :launcher:compileReleaseRenderscript NO-SOURCE
> Task :launcher:checkReleaseManifest
> Task :launcher:generateReleaseBuildConfig
> Task :launcher:generateReleaseSources
> Task :launcher:mainApkListPersistenceRelease
> Task :launcher:generateReleaseResValues
> Task :launcher:generateReleaseResources
> Task :unityLibrary:generateReleaseRFile
> Task :unityLibrary:processReleaseJavaRes NO-SOURCE
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:compileReleaseJavaWithJavac
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:bundleLibCompileRelease
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:prepareLintJarForPublish
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:mergeReleaseShaders
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:compileReleaseShaders
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:generateReleaseAssets
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:packageReleaseAssets
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:bundleLibRuntimeRelease
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:processReleaseJavaRes NO-SOURCE
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:bundleLibResRelease
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:mergeReleaseJniLibFolders
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:transformNativeLibsWithMergeJniLibsForRelease
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:transformNativeLibsWithStripDebugSymbolForRelease
> Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:transformNativeLibsWithIntermediateJniLibsForRelease
> Task :unityLibrary:mergeReleaseJniLibFolders
> Task :launcher:mergeReleaseResources
> Task :launcher:createReleaseCompatibleScreenManifests
> Task :unityLibrary:javaPreCompileRelease
> Task :launcher:processReleaseManifest
> Task :launcher:processReleaseResources FAILED

> Task :unityLibrary:compileReleaseJavaWithJavac

Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.1.1/userguide/command_line_interface.html#sec:command_line_warnings
44 actionable tasks: 44 executed
]
exit code: 1
UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <d76da2c9a45b4b02b93f56ae560b1d44>:0)
UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <d76da2c9a45b4b02b93f56ae560b1d44>:0)
UnityEditor.Android.Command.Run (System.String command, System.String args, System.String workingdir, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <d76da2c9a45b4b02b93f56ae560b1d44>:0)
UnityEditor.Android.AndroidJavaTools.RunJava (System.String args, System.String workingdir, System.Action`1[T] progress, System.String error) (at <d76da2c9a45b4b02b93f56ae560b1d44>:0)
UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, System.String task, System.Action`1[T] progress) (at <d76da2c9a45b4b02b93f56ae560b1d44>:0)
Rethrow as GradleInvokationException: Gradle build failed
UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, System.String task, System.Action`1[T] progress) (at <d76da2c9a45b4b02b93f56ae560b1d44>:0)
UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <d76da2c9a45b4b02b93f56ae560b1d44>:0)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <d76da2c9a45b4b02b93f56ae560b1d44>:0)
Rethrow as BuildFailedException: Exception of type 'UnityEditor.Build.BuildFailedException' was thrown.
UnityEditor.Android.PostProcessor.CancelPostProcess.AbortBuild (System.String title, System.String message, System.Exception ex) (at <d76da2c9a45b4b02b93f56ae560b1d44>:0)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <d76da2c9a45b4b02b93f56ae560b1d44>:0)
UnityEditor.Android.PostProcessAndroidPlayer.PostProcess (UnityEditor.BuildTarget target, System.String stagingAreaData, System.String stagingArea, System.String playerPackage, System.String installPath, System.String companyName, System.String productName, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at <d76da2c9a45b4b02b93f56ae560b1d44>:0)
UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <d76da2c9a45b4b02b93f56ae560b1d44>:0)
UnityEditor.PostprocessBuildPlayer.Postprocess (UnityEditor.BuildTargetGroup targetGroup, UnityEditor.BuildTarget target, System.String installPath, System.String companyName, System.String productName, System.Int32 width, System.Int32 height, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at <4a1b55d6b009421a9ad1d16b54b782d5>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

Build completed with a result of ‘Failed’ in 295 seconds (294710 ms)
UnityEngine.GUIUtility:ProcessEvent (int,intptr)

UnityEditor.BuildPlayerWindow+BuildMethodException: 4 errors
at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlayerOptions options) [0x002bf] in <4a1b55d6b009421a9ad1d16b54b782d5>:0
at UnityEditor.BuildPlayerWindow.CallBuildMethods (System.Boolean askForBuildLocation, UnityEditor.BuildOptions defaultBuildOptions) [0x00080] in <4a1b55d6b009421a9ad1d16b54b782d5>:0
UnityEngine.GUIUtility:ProcessEvent (int,intptr)

I personally believe that the problem is the

no ?

You are correct, this is the reason why your build fails. Exporting project is one way to do it (as instructions in your screenshot specify), but you can also add a custom base gradle template and change the android gradle plugin version from 3.4.0 to 3.4.3 in there.
To create a custom base gradle template, go to “player settings” and then “publishing settings” section. You will see a checkbox called “Custom Base Gradle Template”. Enable it to create the file. Then modify the version inside of that file using a text editor.
7385009--901277--upload_2021-8-3_15-42-9.png