Unity Build Error : ('Assets/Plugins/UnityPurchasing/Bin/Stores.dll') : the dll is not allowed to be included or could not be found

Unity Build Error : ('Assets/Plugins/UnityPurchasing/Bin/Stores.dll') : the dll is not allowed to be included or could not be found

我正在尝试在 Unity 2017 中构建 APK(针对 Android),但遇到了一个奇怪的构建错误。

这是我所做的:

(1) 我已经导入了Unity IAP,并验证了lib Store.dll确实存在于文件夹"Assets/Plugins/UnityPurchasing/Bin/Stores.dll"[=11=中]

(2) 我已将 构建设置 > 播放器设置 > API 兼容级别 更改为 Net 2.0

但是,我仍然遇到这个构建错误:

ArgumentException:程序集 UnityEngine.Purchasing 被商店 ('Assets/Plugins/UnityPurchasing/Bin/Stores.dll') 引用。但是不允许包含或找不到该dll。 UnityEditor.AssemblyHelper.AddReferencedAssembliesRecurse(System.String assemblyPath,System.Collections.Generic.List1 alreadyFoundAssemblies, System.String[] allAssemblyPaths, System.String[] foldersToSearch, System.Collections.Generic.Dictionary2 缓存,BuildTarget 目标)(位于 /Users/builduser/buildslave/unity/build/Editor/Mono/AssemblyHelper.cs:156) UnityEditor.AssemblyHelper.FindAssembliesReferencedBy(System.String[] 路径,System.String[] foldersToSearch,BuildTarget 目标)(在 /Users/builduser/buildslave/unity/build/Editor/Mono/AssemblyHelper.cs:196) UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

请告诉我如何修复此构建错误。谢谢

我已经解决了这个问题。

基本上,我需要按如下方式启用 IAP 购买选项:转到 Unity 菜单栏 -> 单击 Window ->服务 -> 应用内购买 -> 启用

之后,构建工作正常。

--

PS: 我在切换项目几次,忘记在新项目中重新启用 IAP。这就是出现此错误的原因。