尝试使用 il2cpp 构建 Unity 项目时抛出错误

时间:2021-05-28 23:42:50

标签: unity3d mono apk il2cpp

我该如何解决这个问题? 与 MONO 一起,一切顺利 我的Unity版本是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

我试图将一个项目构建到一个 apk 文件中,以便在 Google Play 上发布

1 个答案:

答案 0 :(得分:1)

您使用的是哪个版本的 Google 移动广告 Unity 插件?

问题来自 Google Mobile Ads Unity Plugin v6.0.0 版。我尝试使用以前的 5.4.0v 版本构建项目,并且构建正确。

我发现有更多人遇到同样的问题,我认为他们已经在着手解决这个问题。

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

相关问题