title: Building Unity project with Firebase Google Analytics SDK fails: "Could not load file or assembly 'UnityEditor.iOS.Extensions.Xcode"
body: <h1>The Problem</h1>
  
  <p>I am trying to integrate Firebase Google Analytics into my existing Unity project (a mobile game for iOS and Android). I was following the instructions on <a href="https://firebase.google.com/docs/unity/setup" rel="nofollow noreferrer">https://firebase.google.com/docs/unity/setup</a> (all the prerequisites are fullfilled). Unfortunately when trying to build the Android version on Windows I get the following errors:</p>
  
  <pre><code>BadImageFormatException: Could not resolve field token 0x040000dc, due to: Could not load type of field 'Firebase.Editor.XcodeProjectModifier:projectInfoDoc' (2) due to: Could not load file or assembly 'UnityEditor.iOS.Extensions.Xcode, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. assembly:UnityEditor.iOS.Extensions.Xcode, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null type:&lt;unknown type&gt; member:(null) signature:&lt;none&gt; assembly:C:\Users\mform\Code\guessme\Assets\Firebase\Editor\Firebase.Editor.dll type:XcodeProjectModifier member:(null) signature:&lt;none&gt;
  System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at &lt;567df3e0919241ba98db88bec4c6696f&gt;:0)
  Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
  System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at &lt;567df3e0919241ba98db88bec4c6696f&gt;:0)
  System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at &lt;567df3e0919241ba98db88bec4c6696f&gt;:0)
  UnityEditor.Build.BuildPipelineInterfaces+AttributeCallbackWrapper.OnPostprocessBuild (UnityEditor.Build.Reporting.BuildReport report) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildPipelineInterfaces.cs:158)
  UnityEditor.Build.BuildPipelineInterfaces+&lt;OnBuildPostProcess&gt;c__AnonStorey2.&lt;&gt;m__1 (UnityEditor.Build.IPostprocessBuildWithReport bpp) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildPipelineInterfaces.cs:398)
  UnityEditor.Build.BuildPipelineInterfaces.InvokeCallbackInterfacesPair[T1,T2] (System.Collections.Generic.List`1[T] oneInterfaces, System.Action`1[T] invocationOne, System.Collections.Generic.List`1[T] twoInterfaces, System.Action`1[T] invocationTwo, System.Boolean exitOnFailure) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildPipelineInterfaces.cs:356)
  UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr) (at C:/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:179)
  
  Error building Player: BadImageFormatException: Could not resolve field token 0x040000dc, due to: Could not load type of field 'Firebase.Editor.XcodeProjectModifier:projectInfoDoc' (2) due to: Could not load file or assembly 'UnityEditor.iOS.Extensions.Xcode, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. assembly:UnityEditor.iOS.Extensions.Xcode, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null type:&lt;unknown type&gt; member:(null) signature:&lt;none&gt; assembly:C:\Users\mform\Code\guessme\Assets\Firebase\Editor\Firebase.Editor.dll type:XcodeProjectModifier member:(null) signature:&lt;none&gt;
  </code></pre>
  
  <p>I don't understand why it attempts to load this assembly, which is cleary only intended for iOS anyway. And I don't know how to prevent it or get rid of this bug.</p>
  
  <h1>The Setup</h1>
  
  <ul>
  <li>Windows 10 Pro</li>
  <li>existing Unity project with working Android/iOS builds</li>
  <li>Unity <strong>2019.2.16f1</strong> </li>
  <li>Using the OpenJDK and Android SDK/NDK packaged with Unity
  
  <ul>
  <li>OpenJDK 1.8</li>
  <li>Android SDK tools 29.0.2</li>
  </ul></li>
  <li>current dependencies (all working as expected)
  
  <ul>
  <li><a href="https://developers.google.com/admob/unity/start" rel="nofollow noreferrer">Google Admob SDK for Unity</a></li>
  <li><a href="https://docs.unity3d.com/Manual/UnityAnalytics.html" rel="nofollow noreferrer">Unity Analytics</a></li>
  <li><a href="https://docs.unity3d.com/Manual/UnityIAPSettingUp.html" rel="nofollow noreferrer">Unity IAP</a></li>
  <li><a href="https://github.com/getsentry/sentry-unity" rel="nofollow noreferrer">Sentry</a></li>
  <li><a href="https://assetstore.unity.com/packages/tools/visual-scripting/playmaker-368" rel="nofollow noreferrer">PlayMaker</a></li>
  </ul></li>
  <li>I added Google Analytics as described in <a href="https://firebase.google.com/docs/unity/setup" rel="nofollow noreferrer">https://firebase.google.com/docs/unity/setup</a>
  
  <ul>
  <li>I completed all the steps</li>
  <li>When executed in the editor the CheckAndFixDependenciesAsync continuation is called and the Firebase Dependency status is "Available"</li>
  </ul></li>
  </ul>
  
  <p><em>Build Settings</em></p>
  
  <p><a href="https://i.stack.imgur.com/UZ4cj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UZ4cj.png" alt="enter image description here"></a></p>
  
  <p><em>Player Settings</em></p>
  
  <p><a href="https://i.stack.imgur.com/hVIdV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hVIdV.png" alt="enter image description here"></a></p>
  
  <h1>Solution Attempts</h1>
  
  <ul>
  <li>I reset all changes via Git and started the steps again from the start, importing the SDK unity package anew</li>
  <li>Using the Play Service resolver
  
  <ul>
  <li>I updated the Version Handler</li>
  <li>I forced resolving of the Android dependencies (which works)</li>
  </ul></li>
  <li>deleted the Library folder and rebuild</li>
  </ul>
  
  <p>None of these helped unfortunately. I'd be very grateful for any pointers into the right direction.</p>