Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

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

Discussion in 'Unity IAP' started by Gillissie, Apr 25, 2021.

  1. Gillissie

    Gillissie

    Joined:
    May 16, 2011
    Posts:
    294
    In this order...
    Warning:

    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:
    https://forum.unity.com/threads/iap-troubleshooting-remove-and-reinstall-unity-iap.511747/
     
  2. Gillissie

    Gillissie

    Joined:
    May 16, 2011
    Posts:
    294
    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
     
  3. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    @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.
     
  4. juliobds

    juliobds

    Joined:
    Dec 27, 2011
    Posts:
    25
    @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"? ^^^^
     
  5. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    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.
     
    Last edited: Apr 27, 2021
  6. chanon81

    chanon81

    Joined:
    Oct 6, 2015
    Posts:
    168
    I was on 2020.3.2f1 and tried upgrading to 2020.3.6f1 and now have these kind of Errors:

    Code (CSharp):
    1. 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:

    Code (CSharp):
    1. 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.
     
    Last edited: May 4, 2021
  7. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    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://forum.unity.com/threads/sample-iap-project.529555/#post-6950270
     
  8. enhawk

    enhawk

    Joined:
    Aug 22, 2013
    Posts:
    832
    @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.

    Screen Shot 2022-07-21 at 18.53.09.png
     
    Last edited: Jul 21, 2022
  9. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    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.
     
  10. enhawk

    enhawk

    Joined:
    Aug 22, 2013
    Posts:
    832
    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
     
    Last edited: Jul 22, 2022
  11. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    Yes, the release notes in Package Manager mention to remove this folder also. I'm glad you were able to make progress.
     
  12. Mustafasalema

    Mustafasalema

    Joined:
    Sep 7, 2021
    Posts:
    2
    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
     
  13. Mustafasalema

    Mustafasalema

    Joined:
    Sep 7, 2021
    Posts:
    2
    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
     
  14. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    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).
     
  15. alirao0076

    alirao0076

    Joined:
    Dec 26, 2022
    Posts:
    1
    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?
     
  16. Laurie-Unity

    Laurie-Unity

    Unity Technologies

    Joined:
    Mar 5, 2020
    Posts:
    213
    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