Unity Android build fails on build agent but not manually

Completed

Hi,
I've been trying to set up my machine with a TeamCity Server & Build agent that runs a Unity Build Script to make an apk of our game. It runs it with the following command:


%UNITY_EXECUTABLE% -batchmode -buildTarget Android -executeMethod DevOps.TeamCityBuilder.BuildAPK -projectPath "%teamcity.build.checkoutDir%" -logFile "C:\Users\Anthony\Documents\buildlogteamcity.txt" -quit


However when I run this through TeamCity I get an error:

Uploading Crash Report
CommandInvokationFailure: Gradle build failed.
C:\Program Files\Unity\Hub\Editor\2020.1.15f1\Editor\Data\PlaybackEngines\AndroidPlayer\OpenJDK\bin\java.exe -classpath "C:\Program Files\Unity\Hub\Editor\2020.1.15f1\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-5.6.4.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "assembleDebug"

stderr[

FAILURE: Build failed with an exception.

* What went wrong:
java.io.IOException: The filename, directory name, or volume label syntax is incorrect

Where UNITY_EXECUTABLE is set as the path to Unity.exe on my C drive.

When I run it locally myself via cmd in the checkoutDir TeamCity found, it works with no issues, and I get an apk, it's just via TeamCity that this error seems to occur.

I've uploaded a version of  the build script that has been edited to not show private data.
I also have uploaded the build logs from TeamCity, and from my manual running,
Upload id: 2021_07_15_Sh9pEZa77rBbFkhU (files: TeamCityBuilder.cs and 2 more)

Any help would be greatly appreciated.
 

1 comment
Comment actions Permalink

Solved my issue, I had a GRADLE_USER_HOME environment variable that had to be set to C:/gradle-cache due to the path being to long, but I initially had set it with quotes around it e.g. "C/gradle-cache" but it needs to not have the quotation marks, e.g. C:/gradle-cache

0

Please sign in to leave a comment.