Reputation: 880
I am trying to build an APK (for Android) in Unity 2017, but get a strange build error.
Here are what I have done:
(1) I have already imported Unity IAP, and have verified that the lib Store.dll actually exists inside the folder "Assets/Plugins/UnityPurchasing/Bin/Stores.dll"
(2) I have changed the Build Settings > Player Settings > API Compatibility Level to Net 2.0.
However, I still have this build error:
ArgumentException: The Assembly UnityEngine.Purchasing is referenced by Stores ('Assets/Plugins/UnityPurchasing/Bin/Stores.dll'). But the dll is not allowed to be included or could not be found.
UnityEditor.AssemblyHelper.AddReferencedAssembliesRecurse (System.String assemblyPath, System.Collections.Generic.List1 alreadyFoundAssemblies, System.String[] allAssemblyPaths, System.String[] foldersToSearch, System.Collections.Generic.Dictionary
2 cache, BuildTarget target) (at /Users/builduser/buildslave/unity/build/Editor/Mono/AssemblyHelper.cs:156)
UnityEditor.AssemblyHelper.FindAssembliesReferencedBy (System.String[] paths, System.String[] foldersToSearch, BuildTarget target) (at /Users/builduser/buildslave/unity/build/Editor/Mono/AssemblyHelper.cs:196)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
Please let me know how to fix this build error. Thanks.
Upvotes: 0
Views: 6913
Reputation: 880
I have solved this issue.
Basically, I need to ENABLE the IAP purchase option as follow: Go to the Unity menu bar -> Click on Window -> Services -> In App Purchase -> Enable.
After that, the build works fine.
--
PS: I was switching projects a few times and forgot to re-enable the IAP in the new project. That was the reason for this bug to show up.
Upvotes: 0