Multiple warnings and errors when clicking the "Import" button after installing 3.1.0

Warning:
[ICODE]
The package cache was invalidated and rebuilt because the following immutable asset(s) were unexpectedly altered:
Packages/com.unity.purchasing/Editor/IAPButtonEditor.cs
Packages/com.unity.purchasing/Editor/IAPGeneratedCredentials.cs.template
Packages/com.unity.purchasing/Plugins/UnityPurchasing/Android/AmazonAppStore.aar
Packages/com.unity.purchasing/Plugins/UnityPurchasing/Android/SamsungApps.aar
Packages/com.unity.purchasing/Plugins/UnityPurchasing/Android/common.aar
Packages/com.unity.purchasing/Plugins/UnityPurchasing/iOS/UnityPurchasing.m
Packages/com.unity.purchasing/Plugins/UnityPurchasing/unitypurchasing.bundle/Contents/Info.plist
Packages/com.unity.purchasing/Plugins/UnityPurchasing/unitypurchasing.bundle/Contents/MacOS/unitypurchasing
Packages/com.unity.purchasing/Runtime/Codeless/CodelessIAPStoreListener.cs
Packages/com.unity.purchasing/Runtime/Codeless/IAPButton.cs
Packages/com.unity.purchasing/Runtime/Codeless/IAPConfigurationHelper.cs
Packages/com.unity.purchasing/Runtime/Codeless/IAPListener.cs

Error:
Library/PackageCache/com.unity.purchasing@3.1.0/Runtime/AppleCore/INativeAppleStore.cs(5,42): error CS0122: 'UnityPurchasingCallback' is inaccessible due to its protection level

Error:

Microsoft (R) Visual C# Compiler version 2.9.1.65535 (9d34608e)
Copyright (C) Microsoft Corporation. All rights reserved.

error CS1704: An assembly with the same simple name 'Purchasing.Common' has already been imported. Try removing one of the references (e.g. '/[path to project]/Library/ScriptAssemblies/Purchasing.Common.dll') or sign them to enable side-by-side.```

Error:

Plugin ‘Assets/Plugins/UnityPurchasing/Bin/Purchasing.Common.dll’ has the same filename as Assembly Definition File ‘Packages/com.unity.purchasing/Runtime/Common/Purchasing.Common.asmdef’. Rename the assemblies to avoid hard to diagnose issues and crashes.```

Error:

Microsoft (R) Visual C# Compiler version 2.9.1.65535 (9d34608e)
Copyright (C) Microsoft Corporation. All rights reserved.

error CS1704: An assembly with the same simple name 'Purchasing.Common' has already been imported. Try removing one of the references (e.g. '/[path to project]/Assets/Plugins/UnityPurchasing/Bin/Purchasing.Common.dll') or sign them to enable side-by-side.

I followed these instructions for removing the old IAP completely first:

More errors after I disabled then re-enabled the IAP feature…

Plugin 'Assets/Plugins/UnityPurchasing/Bin/Purchasing.Common.dll' has the same filename as Assembly Definition File 'Packages/com.unity.purchasing/Runtime/Common/Purchasing.Common.asmdef'. Rename the assemblies to avoid hard to diagnose issues and crashes.

Library/PackageCache/com.unity.purchasing@3.1.0/Runtime/SecurityStub/AppleValidator.cs(33,10): error CS0433: The type 'AppleReceipt' exists in both 'Security, Version=1.0.7698.24420, Culture=neutral, PublicKeyToken=null' and 'UnityEngine.Purchasing.SecurityCore, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'

Library/PackageCache/com.unity.purchasing@3.1.0/Runtime/SecurityStub/AppleValidator.cs(53,10): error CS0433: The type 'AppleReceipt' exists in both 'Security, Version=1.0.7698.24420, Culture=neutral, PublicKeyToken=null' and 'UnityEngine.Purchasing.SecurityCore, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'```

```Library/PackageCache/com.unity.purchasing@3.1.0/Runtime/SecurityStub/CrossPlatformValidator.cs(43,16): error CS0433: The type 'IPurchaseReceipt' exists in both 'Security, Version=1.0.7698.24420, Culture=neutral, PublicKeyToken=null' and 'UnityEngine.Purchasing.SecurityCore, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'```

```Library/PackageCache/com.unity.purchasing@3.1.0/Runtime/SecurityStub/GooglePlayReceipt.cs(32,35): error CS0433: The type 'IPurchaseReceipt' exists in both 'Security, Version=1.0.7698.24420, Culture=neutral, PublicKeyToken=null' and 'UnityEngine.Purchasing.SecurityCore, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'```

```Library/PackageCache/com.unity.purchasing@3.1.0/Runtime/AppleCore/INativeAppleStore.cs(5,42): error CS0122: 'UnityPurchasingCallback' is inaccessible due to its protection level```

@Gillissie It looks like you haven’t deleted /Assets/Plugins/UnityPurchasing. Or you did, and then you reimported IAP from the Services window. Don’t do that, we will be removing the Services window altogether in a future version of Unity. Install IAP (only) from Package Manager.

2 Likes

@JeffDUnity3D “Don’t do that”!? Really?

The whole thing is scuffed ATM. You need to import IAP from the Services Window and cherry pick only the demo related files to have access to the Demo scene. There are demo scripts named demo outside of the demo folder BTW SMH.

Then for the whole thing to work you have to manually add UNITY_PURCHASING to your build define symbols. None of this is documented and makes everyone waste their time.

How about you guys at unity “Don’t do that”? ^^^^

1 Like

Correct, don’t do that (for now, it’s not the final design!). Well, you can do that, but you’ll likely run into errors. You don’t want to import again after you’ve already deleted the folders. Don’t do that, as you’ve instructed not to. It’s a bug (actually a lingering design feature) that you will want to avoid, so don’t do that! We are removing the services window altogether in a future release, as mentioned. Don’t add UNITY_PURCHASING either, it’s no longer needed. We are aware of the demo prefab outside of the expected folder, we are working on that too.

I was on 2020.3.2f1 and tried upgrading to 2020.3.6f1 and now have these kind of Errors:

type 'AppleReceipt' exists in both 'Security, Version=1.0.7698.24420, Culture=neutral, PublicKeyToken=null' and 'UnityEngine.Purchasing.SecurityCore

I thought 2020.3 was supposed to be a LTS version? Why are updates causing breaking changes???

I’ve removed the /Assets/Plugins/UnityPurchasing folder … now I’m having this error:

The type or namespace name 'ProductCatalog' could not be found (are you missing a using directive or an assembly reference?)

EDIT:

Ok, I had to add UnityEngine.Purchasing.Stores to my asmdef to fix the above error.
But now I can’t get my AppleTangle and GooglePlayTangle to compile … guess I will have to regenerate them or something.

You just need to wrap them in Try/Catch block and catch the NotImplemented exception. The Receipt Validator only works on devices, not in the Editor. The Sample IAP Project v2 shows an example in IAPManager.cs https://discussions.unity.com/t/700293/3

@JeffDUnity3D

Hi I just got this same flow of errors after upgrading Unity version. (LTS 2019.4.17 → 2019.4.40)

For those of us who have not actually touched anything, how to solve?

A step by step guide would be much appreciated. I get messages like: "
‘Packages/com.unity.purchasing/Editor/AppleIncRootCertificate.cer’ conflicts with:
‘Assets/Plugins/UnityPurchasing/Editor/AppleIncRootCertificate.cer’ (current owner)" An have no idea which one to delete.

Make a project back up, and delete your entire /Library folder. Are you using ASMDEFs? If you still have issues, compare to a brand new project and add IAP and see if you receive the same error.

I fixed by removing Assets/Plugins/UnityPurchasing from the project.

That might be the difference when upgrading unity is that the newer version of IAP is automatically installed into package manager

Yes, the release notes in Package Manager mention to remove this folder also. I’m glad you were able to make progress.

error CS1704: An assembly with the same simple name ‘Purchasing.Common’ has already been imported. Try removing one of the references (e.g. how to fix it ,please help out

Library/PackageCache/com.unity.purchasing@4.0.3/Runtime/WinRTStub/Factory.cs(15,23): error CS0433: The type ‘IWindowsIAP’ exists in both ‘UnityEngine.Purchasing.WinRTCore, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null’ and ‘winrt, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null’. , this also how to fix it

Please test and compare to a new/empty project. You’ll want to be using the latest IAP which is currently 4.4.1. You might also try just deleting the /Library folder (after making a full project backup).

Library\PackageCache\com.unity.purchasing@4.4.1\Runtime\WinRTStub\Factory.cs(15,23): error CS0433: The type ‘IWindowsIAP’ exists in both ‘UnityEngine.Purchasing.WinRTCore, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null’ and ‘winrt, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null’

how i can solve this error?

Hi @alirao0076

Can you try deleting the /Library folder (after making a full project backup) and let me know if that resolves the issue.

If that doesn’t resolve the issue, can you please share a copy of your Packages/manifest.json file and let me know what version of Editor you are using so we can identify what is causing the conflict. Feel free to send the file to me in a DM