Unity Analytics 'does not exist in the current context' when building with Jenkins.

Hi,

I have recently began using Unity Analytics, which is working fine locally. (Enabled via windows → services).

However, once committed to source control, the Jenkins builder gets the following error:
error CS0103: The name `Analytics’ does not exist in the current context

I have tried opening Unity 5.3.4f1 on our Jenkins machine and enabling the Analytics service there, which appears to work. But Unity must be closed for the Jenkins ‘Unity -batchmode’ build player command to execute…
Which results in the error stated above.

Our UnityConnectSettings.asset has analytics as enabled, and the correct ‘cloud project id’ is set in ProjectSettings.asset.

Any help would be much appreciated,

Thanks.

We actually ran into this the other day with another customer using a build machine. This mightn’t be the entire fix, but let’s start with this and see how it goes…

Try this amendment to the the line that opens Unity in your build script:

open ./path/to/Unity.app —args -skipMissingUPID

As long as the checked-in project has previously been activated for Analytics (and therefore attached to a Unity ProjectID), that should compile without errors. Let me know how it goes!

Just been informed that there is also this…which should have occurred to me first:

So adding here for posterity.