Unity Ads compilation error only with Jenkins

Hey guys,

We have a (yet) simple project in Unity 2018.2.0f2. I use win10 Unity, win10 Jenkins agent with SYSTEM user and Jenkins’ Unity3d plugin.
My problem is:

If I build the project in command line with
Unity.exe" -quit -batchmode -logFile build.log -projectPath e:\myproject -executeMethod Builder.Build Android
Unity compiles and builds correctly the .apk file.

When I want to build the same project (from bitbucket) via Jenkins Unity throws a compilation error:

error CS0246: The type or namespace name `ShowResult' could not be found. Are you missing an assembly reference?

If I comment out the Ads related function but leave the ’
using UnityEngine.Advertisements;’ include the compilation is OK.
The code is:

        private void HandleShowAdResults( ShowResult result )
        {
            switch ( result )
            {
                case ShowResult.Finished:
                    Debug.Log( "AD: The ad was successfully shown." );
                    break;
                case ShowResult.Skipped:
                    Debug.Log( "AD: The ad was skipped before reaching the end." );
                    break;
                case ShowResult.Failed:
                    Debug.LogError( "AD: The ad failed to be shown." );
                    break;
            }

            RestartLevel();
        }

I checked the ProgramData unity cache folder and the ads dll is present and I also checked file readings with ProcMon…
Does anybody experienced this error? Any suggestions?

Thanks in advance!

What is ShowResult? which class is it and where is it defined? are you sure you have it on your Jenkins machine ?