How to add arguments to gradle.exe during the build process

Hey guys! I’m running into an annoying build error when trying to generate an Android build from within the editor.

LogPlayLevel:   FAILURE: Build failed with an exception.
LogPlayLevel:   * What went wrong:
LogPlayLevel:   48 actionable tasks: 48 executed
LogPlayLevel:   Execution failed for task ':app:processDebugResources'.
LogPlayLevel:   > A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
LogPlayLevel:      > AAPT2 aapt2-4.0.0-6051327-windows Daemon #0: Unexpected error during link, attempting to stop daemon.
LogPlayLevel:        This should not happen under normal circumstances, please file an issue if it does.
LogPlayLevel:   * Try:
LogPlayLevel:   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.
LogPlayLevel:   * Get more help at https://help.gradle.org
LogPlayLevel:   BUILD FAILED in 20s
LogPlayLevel: Error:   ERROR: cmd.exe failed with args /c "D:\GAMEPROJECTPATH\Game\Intermediate\Android\armv7\gradle\rungradle.bat" :app:assembleDebug
LogPlayLevel: Took 138.8074485s to run UnrealBuildTool.exe, ExitCode=6
LogPlayLevel: UnrealBuildTool failed. See log for more details. (C:\PATHTOLOGDIRECTORY\UBT-Resist-Android-Development.txt)
LogPlayLevel: AutomationTool exiting with ExitCode=6 (6)
LogPlayLevel: Completed Launch On Stage: Build Task, Time: 138.306464
LogPlayLevel: BUILD FAILED
PackagingResults: Error: Launch failed! Unknown Error

So far, Googling has only given me one answer - Delete the “Intermediate” folder’s contents and try again - but I’m not having any luck with this (or deleting any of the other editor-generated folders). Additionally, seeing the log for more details as suggested only seems to give me the exact same details.

Therefore, I’d like to actually try running gradle with the verbosity options suggested, such as --stacktrace or --info. However, I’m not sure where to plug these arguments in to have them included while the build is generated under the same context. For instance, navigating directly to the gradle folder below Intermediate and running gradlew.bat results in a different error about a missing keystore. The fact that this error is associated with a different task (not app:processDebugResources), and that I’m not under the impression that I need to be worried about the keystore yet to generate a simple debug build, leads me to believe that it’s trying to generate the build under different circumstances, rather than it actually being a more detailed log of the error I’m receiving from within the editor.

Any insight on how I can generate a more detailed error message would be greatly appreciated!

1 Like

So I am getting this same error. To add those options, rather than running the gradlew.bat call the rungradle.exe command itself. So in that directory run

rungradle.bat :app:assembleDebug --stacktrace

Unfortunately for me, running this didn’t really give me anything other than the same error message, some sort of issue with aapt. The game project I’m working on builds perfectly on another machine, so I am starting to suspect this may be an issue with the latest gradle or Android Studio.

I may have figured this out. I went into Android SDK manager and uninstalled Android SDK Platform 34 and went down to Android SDK Platform 32. The error has since subsided…

4 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.