Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Android Build Failed!

Discussion in 'Android' started by Thanitsak, Mar 31, 2021.

  1. Thanitsak

    Thanitsak

    Joined:
    Jan 4, 2016
    Posts:
    110
    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
    https://imgur.com/XYuj5dt

    > 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
     
  2. Personuo

    Personuo

    Joined:
    Mar 19, 2014
    Posts:
    122
    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.
     
  3. Thanitsak

    Thanitsak

    Joined:
    Jan 4, 2016
    Posts:
    110
    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!
     
  4. Personuo

    Personuo

    Joined:
    Mar 19, 2014
    Posts:
    122
    thank you, but this no useful for me!
     
    hammadkhan642 likes this.
  5. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,772
    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.
     
  6. rabishan-maharjan

    rabishan-maharjan

    Joined:
    Jul 3, 2016
    Posts:
    18
    this worked for me. but i had to untick both template options again to make it work.
     
  7. MrKocurrr

    MrKocurrr

    Joined:
    Nov 12, 2016
    Posts:
    1
    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.
     
    ygeorgas likes this.
  8. Voxel-Busters

    Voxel-Busters

    Joined:
    Feb 25, 2015
    Posts:
    1,829
    Did you try just toggling Android SDK and JDK options in Unity Preferences -> External Tools?
     
  9. hammadkhan642

    hammadkhan642

    Joined:
    Sep 3, 2019
    Posts:
    3
    not useful for me.....
     
  10. havokentity

    havokentity

    Joined:
    Sep 25, 2017
    Posts:
    37
    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
     
  11. segant

    segant

    Joined:
    May 3, 2017
    Posts:
    196
    For me it was a duplicate plugin version.I checked plugins and founded duplicated one deleted it and worked.
     
  12. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    1,444
    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.
     
    lrb likes this.
  13. kshaja

    kshaja

    Joined:
    Sep 22, 2010
    Posts:
    148
    Thanks for this, it worked for me too
     
    lrb likes this.
  14. luiginicastrocgs

    luiginicastrocgs

    Joined:
    Nov 15, 2021
    Posts:
    3
    This was the fixed, thank you!
     
    lrb and ROBYER1 like this.
  15. Houbeenie

    Houbeenie

    Joined:
    Sep 12, 2015
    Posts:
    2

    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.
     
  16. BanjoPesche

    BanjoPesche

    Joined:
    Feb 4, 2022
    Posts:
    1
    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.
     
    Looksee likes this.
  17. JasonBennett

    JasonBennett

    Joined:
    Mar 26, 2014
    Posts:
    10
    OMG thank you so much, was beating my head against the wall for hours before finding this.
     
    jaydnwlsn likes this.
  18. havokentity

    havokentity

    Joined:
    Sep 25, 2017
    Posts:
    37
    Haha so happy I could help !
     
    jaydnwlsn likes this.
  19. TED_Park

    TED_Park

    Joined:
    Apr 26, 2021
    Posts:
    1

    I love u, bro. I solved issue.
     
    Thanitsak likes this.
  20. thePostFuturistUnity

    thePostFuturistUnity

    Joined:
    Nov 16, 2012
    Posts:
    49
    THANK YOU for posting your solution!!!
     
  21. VirtualDestructor

    VirtualDestructor

    Joined:
    May 3, 2014
    Posts:
    40
    Thank you! This just solved my problem.
     
  22. Gustavo_Campestrini

    Gustavo_Campestrini

    Joined:
    Mar 5, 2022
    Posts:
    1
    Love u my brother, it worked!!!
     
  23. realitygarage

    realitygarage

    Joined:
    Feb 17, 2017
    Posts:
    11

    Yeah - disabling Oculus Quest Support in OpenXR did the trick for me as well !
     
  24. cwoppy

    cwoppy

    Joined:
    Sep 16, 2022
    Posts:
    1
    Was having this same problem, disabling Quest Support in OpenXR under XR Plug-in Management fixed it for me!
     
  25. roamerfree

    roamerfree

    Joined:
    Apr 2, 2022
    Posts:
    6
    This helped me fix the issue! Thanks!
     
  26. Akheerstudio

    Akheerstudio

    Joined:
    Dec 1, 2017
    Posts:
    3
    same issue:
    Unity 2020.3.31
    Audience Network Sdk 6.4.0

    Fix:
    I just imported admob sdk 8.3.0, resolved the dependencies, then built and error was gone, then I deleted admob sdk because i'm not using it. Now there are no errors in the build.
     
  27. breban1

    breban1

    Joined:
    Jun 7, 2016
    Posts:
    194
    What kind of hacky software are we using here?

    Unity really needs to focus on bugs and just quirky things that happen in the editor. Who would know to do weird stuff like toggling a check box OFF/ON to fix stuff?

    Please Unity address bugs, then work on features.
     
  28. Voxel-Busters

    Voxel-Busters

    Joined:
    Feb 25, 2015
    Posts:
    1,829
    Unfortunately, this issue was there from quite sometime but haven't seen in recent versions though. Yea, not an expected one.

    We keep testing our plugins very frequently on different versions and imagine something like this keeps popping up. Sometimes we think if anything is logical, but it just fixes it :D
     
    breban1 likes this.
  29. an_n

    an_n

    Joined:
    Apr 17, 2014
    Posts:
    12
    Still works with my 2022.3.8! Thanks so much for the advice!