unity-game-enginebuild.gradlegoogle-contacts-apimobile-ad-mediation

Android resource linking failed when adding Google Ads mediation (Unity)


I had the "Android resource linking failed" error when trying to build gradle. I didn't have this error until I added the Google mediation SDKs (it worked with GoogleMobileAds SDK without mediation), I tried forcing resolve, and everything else I could find online. It's the mediation SDKs for sure. I tried everything, with and without, and as soon I'm importing any one of the SDKs I'm getting these errors.

I am using Unity 2019.4.17f1, and all Unity Android modules installed as recommended. I used the latest version of the mediation SDKs and GoogleMobileAds SDK.

Using: Google Mobile Ads v5.4.0, Facebook Unity Mediation Plugin 3.1.0, Unity Ads Mediation Plugin 2.6.0

The detailed error written below, as well as my console screenshot.

Task :unityLibrary:preBuild UP-TO-DATE Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:preBuild UP-TO-DATE Task :launcher:preBuild UP-TO-DATE Task :unityLibrary:preReleaseBuild UP-TO-DATE Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:preReleaseBuild UP-TO-DATE Task :unityLibrary:checkReleaseManifest UP-TO-DATE Task :launcher:prepareLintJar UP-TO-DATE Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:checkReleaseManifest Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:processReleaseManifest Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:compileReleaseAidl NO-SOURCE Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:packageReleaseRenderscript NO-SOURCE Task :unityLibrary:processReleaseManifest Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:compileReleaseRenderscript NO-SOURCE Task :unityLibrary:compileReleaseAidl NO-SOURCE Task :unityLibrary:packageReleaseRenderscript NO-SOURCE Task :unityLibrary:compileReleaseRenderscript NO-SOURCE Task :unityLibrary:generateReleaseBuildConfig UP-TO-DATE Task :unityLibrary:generateReleaseResValues UP-TO-DATE Task :unityLibrary:generateReleaseResources UP-TO-DATE Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:generateReleaseResValues Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:generateReleaseResources Task :unityLibrary:packageReleaseResources UP-TO-DATE Task :unityLibrary:prepareLintJar UP-TO-DATE Task :unityLibrary:generateReleaseSources UP-TO-DATE Task :unityLibrary:prepareLintJarForPublish UP-TO-DATE Task :unityLibrary:mergeReleaseShaders UP-TO-DATE Task :unityLibrary:compileReleaseShaders UP-TO-DATE Task :unityLibrary:generateReleaseAssets UP-TO-DATE Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:packageReleaseResources Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:generateReleaseRFile Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:generateReleaseBuildConfig Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:prepareLintJar UP-TO-DATE 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 UP-TO-DATE Task :launcher:generateReleaseBuildConfig UP-TO-DATE Task :launcher:generateReleaseSources UP-TO-DATE Task :launcher:mainApkListPersistenceRelease UP-TO-DATE Task :launcher:generateReleaseResValues UP-TO-DATE Task :launcher:generateReleaseResources UP-TO-DATE Task :unityLibrary:generateReleaseRFile UP-TO-DATE Task :unityLibrary:processReleaseJavaRes NO-SOURCE Task :unityLibrary:mergeReleaseJniLibFolders UP-TO-DATE Task :unityLibrary:transformNativeLibsWithMergeJniLibsForRelease UP-TO-DATE Task :unityLibrary:transformNativeLibsWithStripDebugSymbolForRelease UP-TO-DATE Task :launcher:mergeReleaseResources UP-TO-DATE Task :launcher:createReleaseCompatibleScreenManifests UP-TO-DATE Task :unityLibrary:transformNativeLibsWithIntermediateJniLibsForRelease Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:compileReleaseJavaWithJavac Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:bundleLibCompileRelease Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:prepareLintJarForPublish UP-TO-DATE 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:javaPreCompileRelease UP-TO-DATE Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:mergeReleaseJniLibFolders Task :unityLibrary:compileReleaseJavaWithJavac UP-TO-DATE Task :unityLibrary:bundleLibCompileRelease UP-TO-DATE Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:transformNativeLibsWithMergeJniLibsForRelease Task :unityLibrary:bundleLibRuntimeRelease UP-TO-DATE Task :unityLibrary:bundleLibResRelease UP-TO-DATE Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:transformNativeLibsWithStripDebugSymbolForRelease Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:transformNativeLibsWithIntermediateJniLibsForRelease Task :launcher:processReleaseManifest Task :launcher:javaPreCompileRelease Task :launcher:processReleaseResources FAILED

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 51 actionable tasks: 25 executed, 26 up-to-date

UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

Console Screenshot


Solution

  • Had the exact same issue today. You need to upgrade your gradle version.

    Go to Player Settings -> Publishing Settings, and check "Custom Base Gradle Template".

    Custom Base Gradle Template

    In the baseProjectTemplate.gradle, update the gradle version to 3.4.3

    baseProjectTemplate.gradle

    Here's the link to Unity page showing the gradle version compatible with Unity versions: https://docs.unity3d.com/Manual/android-gradle-overview.html

    And here's the page showing which plugin has which version of gradle: https://developer.android.com/studio/releases/gradle-plugin

    Based on this you can upgrade to 3.4.3 This solved the issue for me.