Build error in batch mode (Jenkins)

There's an error log about mediation.
I think that is caused by a problem with Unity Services connection.

Important jenkins logs below.

COMMAND LINE ARGUMENTS:
/Applications/Unity/Hub/Editor/2021.3.14f1/Unity.app/Contents/MacOS/Unity
-quit
-batchmode
-bundleCode
0000
-projectPath
(my project path)
-executeMethod
JenkinsBuild.Android
-logFile
(hidden)
-keyaliasPass
(hidden)
-keystorePass
(hidden)
-username
songsh5775@gmail.com
-password
(hidden)

Unity Editor version: 2021.3.14f1 (eee1884e7226)
Branch: 2021.3/staging
Build type: Release
Batch mode: YES
macOS version: Version 13.0.1 (Build 22A400)
Darwin version: 22.1.0
Architecture: arm64
Running under Rosetta: NO
Available memory: 8192 MB
User songsh5775@gmail.com logged in successfully
[LicensingClient] Handshaking with LicensingClient (version: 1.11.0+2b534b4)
[Licensing::Module] Successfully connected to LicensingClient on channel: "LicenseClient-sanghunsong" (connect: 0.00s, validation: 0.03s, handshake: 0.40s)
Entitlement-based licensing initiated
[Licensing::Module] Successfully updated the access token TkRd3IXM9CYevpQYKxTm4fir4ENsULKRLzFQzXyTsJg00df
[LicensingClient] Licenses updated successfully

[ServicesCore]: To use Unity's dashboard services, you need to link your Unity project to a project ID. To do this, go to Project Settings to select your organization, select your project and then link a project ID. You also need to make sure your organization has access to the required products. Visit https://dashboard.unity3d.com to sign up.
UnityEngine.StackTraceUtility:ExtractStackTrace () (at /Users/bokken/build/output/unity/unity/Runtime/Export/Scripting/StackTrace.cs:37)
UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[ ])
UnityEngine.Logger:LogWarning (string,object)
Unity.Services.Core.Internal.CoreLogger:LogWarning (object) (at Library/PackageCache/com.unity.services.core@1.6.0/Runtime/Core.Internal/Logging/CoreLogger.cs:15)
Unity.Services.Core.Editor.ProjectUnlinkBuildWarning:OnPreprocessBuild (UnityEditor.Build.Reporting.BuildReport) (at Library/PackageCache/com.unity.services.core@1.6.0/Editor/Core/Build/ProjectUnlinkBuildWarning.cs:29)
UnityEditor.Build.BuildPipelineInterfaces/<>c_DisplayClass16_0:b_1 (UnityEditor.Build.IPreprocessBuildWithReport) (at /Users/bokken/build/output/unity/unity/Editor/Mono/BuildPipeline/BuildPipelineInterfaces.cs:436)
UnityEditor.Build.BuildPipelineInterfaces:InvokeCallbackInterfacesPair (System.Collections.Generic.List1<UnityEditor.Build.IPreprocessBuild>,System.Action1,System.Collections.Generic.List1<UnityEditor.Build.IPreprocessBuildWithReport>,System.Action1,bool) (at /Users/bokken/build/output/unity/unity/Editor/Mono/BuildPipeline/BuildPipelineInterfaces.cs:402)
UnityEditor.Build.BuildPipelineInterfaces:OnBuildPreProcess (UnityEditor.Build.Reporting.BuildReport) (at /Users/bokken/build/output/unity/unity/Editor/Mono/BuildPipeline/BuildPipelineInterfaces.cs:434)
UnityEditor.BuildPipeline:BuildPlayerInternal (string[ ],string,string,UnityEditor.BuildTargetGroup,UnityEditor.BuildTarget,int,UnityEditor.BuildOptions,string[ ]) (at /Users/bokken/build/output/unity/unity/Editor/Mono/BuildPipeline.bindings.cs:449)
UnityEditor.BuildPipeline:BuildPlayer (string[ ],string,string,UnityEditor.BuildTargetGroup,UnityEditor.BuildTarget,int,UnityEditor.BuildOptions,string[ ]) (at /Users/bokken/build/output/unity/unity/Editor/Mono/BuildPipeline.bindings.cs:348)
UnityEditor.BuildPipeline:BuildPlayer (UnityEditor.BuildPlayerOptions) (at /Users/bokken/build/output/unity/unity/Editor/Mono/BuildPipeline.bindings.cs:322)
JenkinsBuild:Build (string,string,UnityEditor.BuildTarget,UnityEditor.BuildOptions) (at Assets/Editor/JenkinsBuild.cs:63)
JenkinsBuild:AndroidWithoutResoulution (bool) (at Assets/Editor/JenkinsBuild.cs:22)
JenkinsBuild:Android () (at Assets/Editor/JenkinsBuild.cs:16)
(Filename: Library/PackageCache/com.unity.services.core@1.6.0/Editor/Core/Build/ProjectUnlinkBuildWarning.cs Line: 29)

Uploading Crash Report
BuildFailedException: Build canceled
at Unity.Services.Mediation.Build.Editor.AndroidNativeDependenciesPreBuildCheck.DisplayIssueDetectedDialog (System.Boolean noDialog, System.String issue, Unity.Services.Mediation.Build.Editor.AndroidNativeDependenciesPreBuildCheck+UserAction action) [0x0009a] in /Users/sanghunsong/DEV/Unity/MazeR/Library/PackageCache/com.unity.services.mediation@1.0.4/Editor/Build/PreBuild/AndroidNativeDependenciesPreBuildCheck.cs:144
at Unity.Services.Mediation.Build.Editor.AndroidNativeDependenciesPreBuildCheck.ValidateDependencies (System.Boolean noDialog) [0x0008f] in /Users/sanghunsong/DEV/Unity/MazeR/Library/PackageCache/com.unity.services.mediation@1.0.4/Editor/Build/PreBuild/AndroidNativeDependenciesPreBuildCheck.cs:92
at Unity.Services.Mediation.Build.Editor.AndroidNativeDependenciesPreBuildCheck.OnPreprocessBuild (UnityEditor.Build.Reporting.BuildReport report) [0x0005e] in /Users/sanghunsong/DEV/Unity/MazeR/Library/PackageCache/com.unity.services.mediation@1.0.4/Editor/Build/PreBuild/AndroidNativeDependenciesPreBuildCheck.cs:48
at UnityEditor.Build.BuildPipelineInterfaces+<>c_DisplayClass16_0.b_1 (UnityEditor.Build.IPreprocessBuildWithReport bpp) [0x00000] in /Users/bokken/build/output/unity/unity/Editor/Mono/BuildPipeline/BuildPipelineInterfaces.cs:436
at UnityEditor.Build.BuildPipelineInterfaces.InvokeCallbackInterfacesPairT1,T2 [0x000ff] in /Users/bokken/build/output/unity/unity/Editor/Mono/BuildPipeline/BuildPipelineInterfaces.cs:402
UnityEngine.DebugLogHandler:Internal_LogException(Exception, Object)
UnityEngine.DebugLogHandler:LogException(Exception, Object)
UnityEngine.Logger:LogException(Exception, Object)
UnityEngine.Debug:LogException(Exception)
UnityEditor.Build.BuildPipelineInterfaces:InvokeCallbackInterfacesPair(List1, Action1, List1, Action1, Boolean) (at /Users/bokken/build/output/unity/unity/Editor/Mono/BuildPipeline/BuildPipelineInterfaces.cs:415)
UnityEditor.Build.BuildPipelineInterfaces:OnBuildPreProcess(BuildReport) (at /Users/bokken/build/output/unity/unity/Editor/Mono/BuildPipeline/BuildPipelineInterfaces.cs:434)
UnityEditor.BuildPipeline:BuildPlayerInternalNoCheck(String[ ], String, String, BuildTargetGroup, BuildTarget, Int32, BuildOptions, String[ ], Boolean)
UnityEditor.BuildPipeline:BuildPlayerInternal(String[ ], String, String, BuildTargetGroup, BuildTarget, Int32, BuildOptions, String[ ]) (at /Users/bokken/build/output/unity/unity/Editor/Mono/BuildPipeline.bindings.cs:449)
UnityEditor.BuildPipeline:BuildPlayer(String[ ], String, String, BuildTargetGroup, BuildTarget, Int32, BuildOptions, String[ ]) (at /Users/bokken/build/output/unity/unity/Editor/Mono/BuildPipeline.bindings.cs:348)
UnityEditor.BuildPipeline:BuildPlayer(BuildPlayerOptions) (at /Users/bokken/build/output/unity/unity/Editor/Mono/BuildPipeline.bindings.cs:322)
JenkinsBuild:Build(String, String, BuildTarget, BuildOptions) (at Assets/Editor/JenkinsBuild.cs:63)
JenkinsBuild:AndroidWithoutResoulution(Boolean) (at Assets/Editor/JenkinsBuild.cs:22)
JenkinsBuild:Android() (at Assets/Editor/JenkinsBuild.cs:16)
(Filename: Library/PackageCache/com.unity.services.mediation@1.0.4/Editor/Build/PreBuild/AndroidNativeDependenciesPreBuildCheck.cs Line: 144)

And I cannot understand this situation because the unity account was logged in well as you can see in the log below.

Hi @s-saens_1 , this is not about a user being logged into the Editor, but rather your project being linked to the dashboard in the services section of your project settings.

Hope this helps

Hi @jcGrenier , thank you for your reply.

I already linked my project to the dashboard in the editor.
So if I build my project in the editor, it succeeds, but not in the batch mode.

I added this code in the build process script,

Console.WriteLine("UnityServiceID : " + UnityEditor.CloudProjectSettings.projectId);

then this log was printed on jenkins

...
UnityServiceID :
...

so I found that the project ID is not assigned.

I definitely linked my project in the editor.

2 Likes

Apologies for the delay, I would suggest validating that the projectSettings.asset file has the proper value in
cloudProjectId:, and that the projectSettings file is available to the tool you use to build in batchmode.

I am having the same issue, analytics not connecting when building in batchmode. Did you ever resolve this issue?

We use Jenkins to build using unity command line batchmode nographics, is there any reason that this would reset specifically the CloudProjectSettings.projectID at build time?

I get same error, our project is linked and was working for 2 years now, i tried unlinking and linking, there is project id in ProjectSettings.asset, nothing helps. We use unity cloud build.

Hi guys,
I am no longer part of the Mediation team, so I won't be investigating your issue, but I can offer some advice. Unity's Mediation solution will eventually be decommissioned as Unity has moved towards using LevelPlay.

I highly recommend you switch to Unity LevelPlay to avoid future issues, as no development is made on Unity Mediation anymore.

As for specific project linking issues, someone from Unity Game Services may be able to help.

Sorry I can't offer more assistance, I hope this helped a little.

One of my coworkers found a UGS.exe that we call to initialize it at runtime via jenkins. Hacky but it works.

I have the same issue with my Jenkins builds. Where I can get UGS.exe and how to call it?

1 Like

How do you resolve this problem? Need help

3 Likes

The same issue

Unity game services not activating when running in batch mode - it crashes.
Could you please provide more information? It`d be very helpful.

We went to the UGS CLI github releases and downloaded the ugs-windows-x64.exe. In our buildscript we call

"PATH_TO_EXE\ugs-windows-x64.exe" login --service-key-id <SERVICE_KEY> --secret-key-stdin <SECRET_KEY>

After this call we make our normal unity nographics batchmode build call.