Search Unity

Help Wanted Cannot set Android Target to UDP

Discussion in 'Unity Distribution Portal (UDP)' started by akirayui, Nov 24, 2020.

  1. akirayui

    akirayui

    Joined:
    Jul 25, 2019
    Posts:
    9
    I tried to implement UDP via Unity IAP but I encountered the error: Cannot set Android target to UDP. Make sure you have installed UDP in your project
    So, the sandbox login window did not pop.

    I followed the steps below:
    1- I enabled Unity IAP from Services and reimported the packages.
    2- Selected target as UDP (Window/Unity IAP/Android/Target UDP)
    3- I created game in UDP console from Editor (Window/Unity Distribution Portal/Settings)
    I filled the required fields on the UDP console, added a sandbox user. Credentials are the same in editor and console.
    4- Added products from Window/Unity IAP/IAP Catalog and synced with UDP
    I checked the UDP console, products are there.
    5- Added a script to initialize IAP, list and purchase products. (Already is working on Google Play Store)
    6- I built an apk and uploaded it to App Gallery Cloud Debug for testing it on a device. ( I dont have a real device.)
    7- I got the log file.
    Result: Initialization of IAP is failing and sandbox login window is not showing.

    Unity version : 2020.1.14f1
    IAP version: 2.2.2
    Manager Stripping Level: High
    Custom proguard file:
    -keep class com.unity.udp.**{*;}


    Log:
    2020-11-24 01:10:03 17917-17978/? I/Unity: UnityIAP Version: 2.2.2
    UnityEngine.Purchasing.StandardPurchasingModule:Instance(AppStore)

    (Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 35)
    2020-11-24 01:10:03 17917-17978/? E/Unity: Cannot set Android target to UDP. Make sure you have installed UDP in your project
    UnityEngine.Purchasing.NativeStoreProvider:GetAndroidStoreHelper(IUnityCallback, AppStore, IPurchasingBinder, IUtil)
    UnityEngine.Purchasing.NativeStoreProvider:GetAndroidStore(IUnityCallback, AppStore, IPurchasingBinder, IUtil)
    UnityEngine.Purchasing.StandardPurchasingModule:InstantiateUDP()
    UnityEngine.Purchasing.StandardPurchasingModule:InstantiateStore()
    UnityEngine.Purchasing.StandardPurchasingModule:Configure()
    UnityEngine.Purchasing.PurchasingFactory:.ctor(IPurchasingModule, IPurchasingModule[])
    UnityEngine.Purchasing.ConfigurationBuilder:Instance(IPurchasingModule, IPurchasingModule[])

    2020-11-24 01:10:03 17917-17978/? E/Unity: NotSupportedException: Failed to bind to native store: System.NotImplementedException: The method or operation is not implemented.
    at UnityEngine.Purchasing.NativeStoreProvider.GetAndroidStoreHelper (UnityEngine.Purchasing.IUnityCallback callback, UnityEngine.Purchasing.AppStore store, UnityEngine.Purchasing.Extension.IPurchasingBinder binder, Uniject.IUtil util) [0x00000] in <00000000000000000000000000000000>:0
    at UnityEngine.Purchasing.NativeStoreProvider.GetAndroidStore (UnityEngine.Purchasing.IUnityCallback callback, UnityEngine.Purchasing.AppStore store, UnityEngine.Purchasing.Extension.IPurchasingBinder binder, Uniject.IUtil util) [0x00000] in <00000000000000000000000000000000>:0
    at UnityEngine.Purchasing.StandardPurchasingModule.InstantiateUDP () [0x00000] in <00000000000000000000000000000000>:0
    at UnityEngine.Purchasing.StandardPurchasingModule.InstantiateStore () [0x00000] in <00000000000000000000000000000000>:0
    at UnityEngine.Purchasing.StandardPurchasingModule.Configure () [0x00000]
     
    Last edited: Nov 24, 2020
  2. SamOYUnity3D

    SamOYUnity3D

    Unity Technologies

    Joined:
    May 12, 2019
    Posts:
    388
    Your steps look normal. I noticed that your project is using proguard and the stripping level is high, for further investigation, could you please open a support ticket and share the APK file with us so we can take a look? Thanks.

    You can open a support ticket on the UDP console. https://distribute.dashboard.unity.com/list

    upload_2020-11-24_14-9-47.png
     
  3. akirayui

    akirayui

    Joined:
    Jul 25, 2019
    Posts:
    9
    Hi,
    I opened a support ticket.
    Test APK download link : https://we.tl/t-puanFoBxVe

    Edit: UnityIAP Package Manager imported version is 2.2.1. (up to date)
    I checked for updates, installed version is 2.2.2 (Window/Unity IAP/IAP Updates)
    Is there a conflict?
     
    Last edited: Nov 24, 2020
  4. evilzeppelin

    evilzeppelin

    Joined:
    Dec 1, 2017
    Posts:
    3
    I had the same problem. You need to install the last version of Unity Distribution Portal (2.1.0 atm) via Package Manager. I know that the documentation says that you shouldn't have both packages installed...but you know... Unity
     
  5. akirayui

    akirayui

    Joined:
    Jul 25, 2019
    Posts:
    9
    Thank you.

    I got this error after installation of UDP 2.1.0
    Build failed for same reason.

    Code (CSharp):
    1. PrecompiledAssemblyException: Multiple precompiled assemblies with the same name UDP.dll included or the current platform. Only one assembly with the same name is allowed per platform. Assembly paths:
    2. Assets/UDP/UDP.dll
    3.  
     
  6. LeventP

    LeventP

    Joined:
    Jul 17, 2020
    Posts:
    22
    Check your project files for Assets/Plugins/UDP. If there are files there, remove all of files in there except "UDP Settings.asset".

    The conflict is caused because the earlier versions of IAP used to include UDP with them and it got later removed from IAP, but the old UDP files are still there so you've gotta remove them yourself
     
  7. akirayui

    akirayui

    Joined:
    Jul 25, 2019
    Posts:
    9
    Thank you.

    I removed Unity IAP and UDP packages both. This time I added UDP first and then Unity IAP.
    Conflict error has disappeared but the issue I reported continues:
    "Cannot set Android target to UDP. Make sure you have installed UDP in your project"

    Edit: The issue occurs when Managed Stripping level is set to High or Medium
     
    Last edited: Nov 29, 2020
  8. PlanarBit

    PlanarBit

    Joined:
    Jul 22, 2016
    Posts:
    20
    That's right. It's because UdpIapBridge type gets stripped from UDP.dll.
    Can be fixed by adding "Assets/link.xml" with this content:
    Code (CSharp):
    1. <linker>
    2.   <assembly fullname="UDP" preserve="all"/>
    3. </linker>
    See - https://docs.unity3d.com/2019.3/Documentation/Manual/ManagedCodeStripping.html
     
unityunity