Analytics not found when building from command line

So I get this error when trying to launch my build from from command line:

"C:\Program Files\Unity\Editor\unity.exe" -batchmode -quit --build_path= -projectPath C:\BuildAgent\work\83f46aa43071d679 -executeMethod AutoBuilder.PerformPCBuild -cleanedLogFile C:\BuildAgent	emp\buildTmp\cleaned-1704.log -username "" -password "password"

and it exits with following error:

error CS0103: The name `Analytics' does not exist in the current context

The Analytics comes from UnityAnalytics custom event.

From what I can tell the issue is that the services are connected, even though the files are commited since when I open the project manually on the build agent it works properly.

I’m on Unity version 5.3.

Turns out that the problem was in the deprecated file in project settings: UnityAnalyticsManager. Removing this filed resolved the issue.