Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

代码里using了UnityEngine.Purchasing.Security命名空间导致Android打包inject失败 #1128

Open
Mr-sB opened this issue Mar 13, 2024 · 0 comments

Comments

@Mr-sB
Copy link

Mr-sB commented Mar 13, 2024

触发场景

  • 接入unity IAP包(In App Purchasing)
  • CS代码里using了UnityEngine.Purchasing.Security命名空间
  • Android打包inject失败

错误日志

Error:/[ProjectPath]/Temp/StagingArea/Data/Managed/Assembly-CSharp.dll inject Exception! Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'UnityEngine.Purchasing.Security, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'
at Mono.Cecil.BaseAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference name, Mono.Cecil.ReaderParameters parameters) [0x00100] in :0
at Mono.Cecil.BaseAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference name) [0x00007] in :0
at Mono.Cecil.DefaultAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference name) [0x00025] in :0
at Mono.Cecil.MetadataResolver.Resolve (Mono.Cecil.TypeReference type) [0x00042] in :0
at Mono.Cecil.ModuleDefinition.Resolve (Mono.Cecil.TypeReference type) [0x00006] in :0
at Mono.Cecil.TypeReference.Resolve () [0x00010] in :0
at XLua.Hotfix.isNoPublic (Mono.Cecil.TypeReference type) [0x000a1] in :0
at XLua.Hotfix.genericInOut (Mono.Cecil.MethodDefinition method, XLua.HotfixFlagInTool hotfixType) [0x0001c] in :0
at XLua.Hotfix.InjectType (Mono.Cecil.TypeReference hotfixAttributeType, Mono.Cecil.TypeDefinition type) [0x002d1] in :0
at XLua.Hotfix.HotfixInject (System.String injectAssemblyPath, System.String xluaAssemblyPath, System.Collections.Generic.IEnumerable1[T] searchDirectorys, System.String idMapFilePath, System.Collections.Generic.Dictionary2[TKey,TValue] hotfixConfig) [0x00158] in :0

解决方案

尝试过将包含"Purchasing"的命名空间从[Hotfix]和[CSharpCallLua]中排除,依然失败。
需要将用到UnityEngine.Purchasing.Security的代码放进单独的程序集,让xlua完全忽略它

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant