An error is thrown when trying to build a Unity project with il2cpp

1.1k Views Asked by At

How can i fix this problem? Along with MONO, everything is going well My Unity version is 2021.1.9f1

Exception: Failed running C:\Program Files\Unity\Hub\Editor\2021.1.9f1\Editor\Data\il2cpp\build/deploy/netcoreapp3.1/UnityLinker.exe @"C:/Users/Professional/Fruit Nightmare/Temp/StagingArea/assets/bin/Data/Managed/response.rsp"

stdout:
Fatal error in Unity CIL Linker
Mono.Linker.LinkerFatalErrorException: ILLink: error IL1005: GoogleMobileAds.Api.MobileAds.GetClientFactory(): Error processing method 'GoogleMobileAds.Api.MobileAds.GetClientFactory()' in assembly 'GoogleMobileAds.dll'
 ---> System.InvalidOperationException: No action for the assembly GoogleMobileAds.Unity, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null defined
   at Mono.Linker.AnnotationStore.GetAction(AssemblyDefinition assembly)
   at Mono.Linker.Steps.MarkStep.MarkCustomAttributes(ICustomAttributeProvider provider, DependencyInfo& reason, IMemberDefinition sourceLocationMember)
   at Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference, DependencyInfo reason, IMemberDefinition sourceLocationMember)
   at Mono.Linker.Steps.MarkStep.MarkTypeVisibleToReflection(TypeReference reference, DependencyInfo reason, IMemberDefinition sourceLocationMember)
   at Mono.Linker.Dataflow.ReflectionMethodBodyScanner.<>c__DisplayClass20_4.<HandleCall>b__7()
   at Mono.Linker.Dataflow.ReflectionPatternContext.RecordRecognizedPattern(IMemberDefinition accessedItem, Action mark)
   at Mono.Linker.Dataflow.ReflectionMethodBodyScanner.HandleCall(MethodBody callingMethodBody, MethodReference calledMethod, Instruction operation, ValueNodeList methodParams, ValueNode& methodReturnValue)
   at Mono.Linker.Dataflow.MethodBodyScanner.HandleCall(MethodBody callingMethodBody, Instruction operation, Stack`1 currentStack)
   at Mono.Linker.Dataflow.MethodBodyScanner.Scan(MethodBody methodBody)
   at Mono.Linker.Dataflow.ReflectionMethodBodyScanner.ScanAndProcessReturnValue(MethodBody methodBody)
   at Unity.Linker.Steps.UnityMarkStep.MarkReflectionLikeDependencies(MethodBody body, Boolean requiresReflectionMethodBodyScanner)
   at Mono.Linker.Steps.MarkStep.MarkMethodBody(MethodBody body)
   at Unity.Linker.Steps.UnityMarkStep.MarkMethodBody(MethodBody body)
   at Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method, DependencyInfo& reason)
   at Unity.Linker.Steps.UnityMarkStep.ProcessMethod(MethodDefinition method, DependencyInfo& reason)
   at Mono.Linker.Steps.MarkStep.ProcessQueue()
   --- End of inner exception stack trace ---
   at Mono.Linker.Steps.MarkStep.ProcessQueue()
   at Mono.Linker.Steps.MarkStep.ProcessPrimaryQueue()
   at Mono.Linker.Steps.MarkStep.Process()
   at Mono.Linker.Steps.MarkStep.Process(LinkContext context)
   at Unity.Linker.Steps.UnityMarkStep.Process(LinkContext context)
   at Unity.Linker.UnityPipeline.ProcessStep(LinkContext context, IStep step)
   at Mono.Linker.Pipeline.Process(LinkContext context)
   at Unity.Linker.UnityDriver.UnityRun(ILogger customLogger)
   at Unity.Linker.UnityDriver.RunDriverWithoutErrorHandling(ILogger customLogger)
   at Unity.Linker.UnityDriver.RunDriver()
stderr:

// Here more error text

I was trying to build a project into a apk file for publish on Google Play

1

There are 1 best solutions below

1
On

What version of Google Mobile Ads Unity Plugin are you using?

The problem is from Google Mobile Ads Unity Plugin version v6.0.0. I tried to build the project with the previous version 5.4.0v and it built correctly.

I can see that more people have the same issue, I think they are already working on that.

https://github.com/googleads/googleads-mobile-unity/issues/1613