ILLink: error IL1999: ERROR: Failed to resolve base type

I installed a Polkadot SDK package from the Asset Store and implemented it in my game. It works in editor, but when I build the project, it prompts this error. Can anyone help me fix it?

Building Library\Bee\artifacts\Android\ManagedStripped failed with output:
C:\Program Files\Unity\Hub\Editor\2022.3.6f1\Editor\Data\il2cpp\build\deploy\UnityLinker.exe @Library\Bee\artifacts\rsp\3346739422455441633.rsp
ILLink: error IL1999: ERROR: Failed to resolve base type Newtonsoft.Json.JsonConverter1<Substrate.NetApi.Model.Extrinsics.Extrinsic> for type Substrate.NetApi.TypeConverters.ExtrinsicJsonConverter in assembly Substrate.NetApi.dll when linking against the UnityAot-Linux profile Fatal error in Unity CIL Linker Unity.Linker.StrippingResolutionBaseTypeException: ERROR: Failed to resolve base type Newtonsoft.Json.JsonConverter1<Substrate.NetApi.Model.Extrinsics.Extrinsic> for type Substrate.NetApi.TypeConverters.ExtrinsicJsonConverter in assembly Substrate.NetApi.dll when linking against the UnityAot-Linux profile
at Unity.Linker.MonoBehaviorUtilities.DerivesFrom(UnityLinkContext context, TypeDefinition type, String possibleBaseNames)
at Unity.Linker.MonoBehaviorUtilities.IsMonoBehaviourOrScriptableObject(UnityLinkContext context, TypeDefinition type)
at Unity.Linker.Steps.Rooting.ResolveFromMonoBehaviours.b__6_0(TypeDefinition t)
at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
at Unity.Linker.Steps.Rooting.ResolveFromMonoBehaviours.Process(LinkContext context)
at Unity.Linker.UnityPipeline.ProcessStep(LinkContext context, IStep step)
at Mono.Linker.Pipeline.Process(LinkContext context)
at Unity.Linker.UnityDriver.UnityRun(UnityLinkContext context, UnityPipeline p, LinkRequest linkerOptions, TinyProfiler2 tinyProfiler, ILogger customLogger)
at Unity.Linker.UnityDriver.RunDriverWithoutErrorHandling(TinyProfiler2 tinyProfiler, ILogger customLogger)
at Unity.Linker.UnityDriver.RunDriverWithoutErrorHandling()
at Unity.Linker.UnityDriver.RunDriver()

UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

This error likely means that UnityLinker was given an incompatible set of assemblies. So I’d start by looking at the different things that influence which assemblies are passed to UnityLinker during the player build. Unfortunately, there are a number of mechanisms at play so the best I can do to start off is toss out some guesses.

  1. Are multiple copies of Newtonsoft.Json.dll involved? There are multiple ways this could happen. If the asset store package you added contained a copy and you had the com.unity.nuget.newtonsoft-json package installed. This isn’t necessarily a problem, but if this is happening it’s worth probing further

  2. Is there an asset Newtonsoft.Json.dll anywhere in the project? If so, check the Properties and under “Select platform for plugins” make sure that the file is not setup in a way that it would be excluded from android player builds.

  3. Are there any IFilterBuildAssemblies usages in the project (including in any asset store code)? Unity - Scripting API: IFilterBuildAssemblies. If so, review them and make sure they are not excluding Newtonsoft.Json.dll

1 Like