Android Build Failed!

Please help, I can’t build to Android with this error, tried Unity 2020.2.1f1 and now with Unity 2020.3.2f1 still can’t build

Error Image
Imgur

Configure project :launcher
WARNING: The option ‘android.enableR8’ is deprecated and should not be used anymore.
It will be removed in a future version of the Android Gradle plugin, and will no longer allow you to disable R8.

Task :unityLibrary:GooglePlayGamesManifest.plugin:preBuild UP-TO-DATE
Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:preBuild UP-TO-DATE
Task :launcher:preBuild UP-TO-DATE
Task :unityLibrary:preBuild UP-TO-DATE
Task :unityLibrary:GooglePlayGamesManifest.plugin:preReleaseBuild UP-TO-DATE
Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:preReleaseBuild UP-TO-DATE
Task :launcher:preReleaseBuild UP-TO-DATE
Task :unityLibrary:preReleaseBuild UP-TO-DATE
Task :unityLibrary:packageReleaseRenderscript NO-SOURCE
Task :unityLibrary:GooglePlayGamesManifest.plugin:packageReleaseRenderscript NO-SOURCE
Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:packageReleaseRenderscript NO-SOURCE
Task :launcher:generateReleaseResValues UP-TO-DATE
Task :unityLibrary:generateReleaseResValues UP-TO-DATE
Task :launcher:compileReleaseRenderscript NO-SOURCE
Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:compileReleaseRenderscript NO-SOURCE
Task :launcher:generateReleaseResources UP-TO-DATE
Task :unityLibrary:GooglePlayGamesManifest.plugin:compileReleaseRenderscript NO-SOURCE
Task :unityLibrary:compileReleaseRenderscript NO-SOURCE
Task :launcher:mainApkListPersistenceRelease UP-TO-DATE
Task :unityLibrary:generateReleaseResources UP-TO-DATE
Task :launcher:createReleaseCompatibleScreenManifests UP-TO-DATE
Task :launcher:extractDeepLinksRelease UP-TO-DATE
Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:generateReleaseResValues
Task :unityLibrary:GooglePlayGamesManifest.plugin:generateReleaseResValues
Task :unityLibrary:packageReleaseResources UP-TO-DATE
Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:generateReleaseResources
Task :unityLibrary:GooglePlayGamesManifest.plugin:generateReleaseResources
Task :unityLibrary:extractDeepLinksRelease UP-TO-DATE
Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:packageReleaseResources
Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:extractDeepLinksRelease
Task :unityLibrary:GooglePlayGamesManifest.plugin:packageReleaseResources
Task :unityLibrary:GooglePlayGamesManifest.plugin:extractDeepLinksRelease
Task :unityLibrary:compileReleaseLibraryResources UP-TO-DATE
Task :unityLibrary:generateReleaseBuildConfig UP-TO-DATE
Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:compileReleaseAidl NO-SOURCE
Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:compileReleaseLibraryResources
Task :unityLibrary:GooglePlayGamesManifest.plugin:compileReleaseAidl NO-SOURCE
Task :unityLibrary:parseReleaseLocalResources UP-TO-DATE
Task :unityLibrary:compileReleaseAidl NO-SOURCE
Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:generateReleaseBuildConfig
Task :unityLibrary:GooglePlayGamesManifest.plugin:generateReleaseBuildConfig
Task :unityLibrary:mergeReleaseShaders UP-TO-DATE
Task :unityLibrary:compileReleaseShaders UP-TO-DATE
Task :unityLibrary:generateReleaseAssets UP-TO-DATE
Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:parseReleaseLocalResources
Task :unityLibrary:GooglePlayGamesManifest.plugin:javaPreCompileRelease
Task :unityLibrary:GooglePlayGamesManifest.plugin:mergeReleaseShaders
Task :unityLibrary:GooglePlayGamesManifest.plugin:compileReleaseShaders
Task :unityLibrary:GooglePlayGamesManifest.plugin:processReleaseManifest
Task :unityLibrary:GooglePlayGamesManifest.plugin:generateReleaseAssets
Task :unityLibrary:GooglePlayGamesManifest.plugin:packageReleaseAssets
Task :unityLibrary:GooglePlayGamesManifest.plugin:processReleaseJavaRes NO-SOURCE
Task :unityLibrary:GooglePlayGamesManifest.plugin:bundleLibResRelease
Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:mergeReleaseShaders
Task :unityLibrary:GooglePlayGamesManifest.plugin:mergeReleaseJniLibFolders
Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:compileReleaseShaders
Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:generateReleaseAssets
Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:packageReleaseAssets
Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:processReleaseJavaRes NO-SOURCE
Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:bundleLibResRelease
Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:mergeReleaseJniLibFolders
Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:processReleaseManifest
Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:javaPreCompileRelease
Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:mergeReleaseNativeLibs
Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:stripReleaseDebugSymbols
Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:copyReleaseJniLibsProjectOnly
Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:generateReleaseRFile
Task :unityLibrary:GooglePlayGamesManifest.plugin:compileReleaseLibraryResources
Task :unityLibrary:GooglePlayGamesManifest.plugin:parseReleaseLocalResources
Task :unityLibrary:GooglePlayGamesManifest.plugin:mergeReleaseNativeLibs
Task :unityLibrary:GooglePlayGamesManifest.plugin:stripReleaseDebugSymbols
Task :unityLibrary:GooglePlayGamesManifest.plugin:copyReleaseJniLibsProjectOnly
Task :unityLibrary:GooglePlayGamesManifest.plugin:generateReleaseRFile
Task :unityLibrary:packageReleaseAssets
Task :unityLibrary:processReleaseJavaRes NO-SOURCE
Task :unityLibrary:bundleLibResRelease UP-TO-DATE
Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:compileReleaseJavaWithJavac
Task :unityLibrary:GooglePlayGamesManifest.plugin:compileReleaseJavaWithJavac
Task :unityLibrary:GooglePlayGamesManifest.plugin:bundleLibRuntimeRelease
Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:bundleLibRuntimeRelease
Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:bundleLibCompileRelease
Task :unityLibrary:GooglePlayGamesManifest.plugin:bundleLibCompileRelease
Task :unityLibrary:mergeReleaseJniLibFolders UP-TO-DATE
Task :unityLibrary:javaPreCompileRelease UP-TO-DATE
Task :unityLibrary:mergeReleaseNativeLibs UP-TO-DATE
Task :unityLibrary:stripReleaseDebugSymbols UP-TO-DATE
Task :unityLibrary:copyReleaseJniLibsProjectOnly UP-TO-DATE
Task :unityLibrary:processReleaseManifest
Task :

Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘:launcher:mergeReleaseResources’.

Multiple task action failures occurred:
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
AAPT2 aapt2-3.6.0-6040484-osx Daemon #0: Daemon startup failed
This should not happen under normal circumstances, please file an issue if it does.
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
AAPT2 aapt2-3.6.0-6040484-osx Daemon #1: Daemon startup failed
This should not happen under normal circumstances, please file an issue if it does.
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
AAPT2 aapt2-3.6.0-6040484-osx Daemon #2: Daemon startup failed
This should not happen under normal circumstances, please file an issue if it does.
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
AAPT2 aapt2-3.6.0-6040484-osx Daemon #3: Daemon startup failed
This should not happen under normal circumstances, please file an issue if it does.
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
AAPT2 aapt2-3.6.0-6040484-osx Daemon #4: Daemon startup failed
This should not happen under normal circumstances, please file an issue if it does.
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
AAPT2 aapt2-3.6.0-6040484-osx Daemon #5: Daemon startup failed
This should not happen under normal circumstances, please file an issue if it does.
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
AAPT2 aapt2-3.6.0-6040484-osx Daemon #6: Daemon startup failed
This should not happen under normal circumstances, please file an issue if it does.
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
AAPT2 aapt2-3.6.0-6040484-osx Daemon #7: Daemon startup failed
This should not happen under normal circumstances, please file an issue if it does.

  • 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 5s

UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&) (at /Users/bokken/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:189)

NEXT

CommandInvokationFailure: Gradle build failed.
/Applications/Unity/Hub/Editor/2020.3.2f1/PlaybackEngines/AndroidPlayer/OpenJDK/bin/java -classpath “/Applications/Unity/Hub/Editor/2020.3.2f1/PlaybackEngines/AndroidPlayer/Tools/gradle/lib/gradle-launcher-5.6.4.jar” org.gradle.launcher.GradleMain “-Dorg.gradle.jvmargs=-Xmx4096m” “bundleRelease”

stderr[
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘:launcher:mergeReleaseResources’.

Multiple task action failures occurred:
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
AAPT2 aapt2-3.6.0-6040484-osx Daemon #0: Daemon startup failed
This should not happen under normal circumstances, please file an issue if it does.
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
AAPT2 aapt2-3.6.0-6040484-osx Daemon #1: Daemon startup failed
This should not happen under normal circumstances, please file an issue if it does.
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
AAPT2 aapt2-3.6.0-6040484-osx Daemon #2: Daemon startup failed
This should not happen under normal circumstances, please file an issue if it does.
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
AAPT2 aapt2-3.6.0-6040484-osx Daemon #3: Daemon startup failed
This should not happen under normal circumstances, please file an issue if it does.
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
AAPT2 aapt2-3.6.0-6040484-osx Daemon #4: Daemon startup failed
This should not happen under normal circumstances, please file an issue if it does.
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
AAPT2 aapt2-3.6.0-6040484-osx Daemon #5: Daemon startup failed
This should not happen under normal circumstances, please file an issue if it does.
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
AAPT2 aapt2-3.6.0-6040484-osx Daemon #6: Daemon startup failed
This should not happen under normal circumstances, please file an issue if it does.
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
AAPT2 aapt2-3.6.0-6040484-osx Daemon #7: Daemon startup failed
This should not happen under normal circumstances, please file an issue if it does.

  • 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 5s
]

Build completed with a result of ‘Failed’ in 102 seconds

I’m worse than you, I had this problem in 2020.2, I used various methods to finally solve it, but I don’t know how I solved it (delete cache, set jdk, sdk path, etc.), it was like magic he suddenly got better, it took me 3 days
When I upgraded to 2020.3, the problem came back, and today the first day has passed and I have not solved the problem.

I just got it to fixed with this steps

https://imgur.com/r8XJV6X

Fix by : Go to Edit → Project Settings → Player → Publishing settings → Tick Custom Properties Gradle Template & Custom Main Gradle Template → Restart Unity

So there will be 2 files generated mainTemplate.gradle and gradleTemplate.properties files under Plugins → Android folder as this force Unity build process to use one SDK for the entire build.

Hope this help your problem also anyone who stuck with this as well!

9 Likes

thank you, but this no useful for me!

1 Like

Omg!!

This totally worked for me! The key is restarting unity. it tried it without the restart and it didn’t solve anything. Restarting Unity after enabling these files worked a treat.

this worked for me. but i had to untick both template options again to make it work.

In my case, building app for Oculus Quest 2, the thing that helped was to switch il2cpp to mono. Make a build and than switch it back and magicaly it was working correctly.

1 Like

Did you try just toggling Android SDK and JDK options in Unity Preferences → External Tools?

not useful for me…

I was building app for Oculus Quest 2 and encountered this error…
And you won’t believe what worked for me without messing with gradle stuff.

I disabled Oculus Quest Support in OpenXR under XR Plug-in Management

I fixed all MRTK errors in their popup (This is specific for Mixed Reality Tookit with Unity)

Then it magically compiled and built and ran on my Quest 2

13 Likes

For me it was a duplicate plugin version.I checked plugins and founded duplicated one deleted it and worked.

Thanks this fixed it for me too, I was building to Quest 2 with the XR Plugin Set to Oculus for Android rather than OpenXR but somehow that OpenXR setting from when I did an OpenXR build before seemed to cause the issue somehow?! Absolute shambles for VR developers still.

1 Like

Thanks for this, it worked for me too

1 Like

This was the fixed, thank you!

2 Likes

For our URP project this also worked. We also had Oculus set as the plugin option in XR Plugin Management.

However, for us it also worked when we used the “OVR Scene Quick Preview” and “Build and Deploy Scenes” from there. That builder changes some settings, like changing the scripting backend back to mono and ensuring ARMv7 is used. After testing it turned out that using ARMv7 was the fix. Building with ARM64 would always give the gradle workers$ActionFacade error like in the original post.

So in the end we still have Oculus Quest Support enabled and IL2CPP as scripting backend and we can build.

Had the same problem today. Fixed by disabling Oculus Quest Support in OpenXR section. My Android XR settings specify to use Oculus as plugin source, so I would not have expected it to interfere with my build in this way.

1 Like

OMG thank you so much, was beating my head against the wall for hours before finding this.

1 Like

Haha so happy I could help !

1 Like

I love u, bro. I solved issue.

1 Like

THANK YOU for posting your solution!!!